Chouti was tired of the tedious homework, so he opened up an old programming problem he created years ago.

You are given a connected undirected graph with n vertices and m weighted edges. There are k special vertices: x_1, x_2, …, x_k.

Let's define the cost of the path as the maximum weight of the edges in it. And the distance between two vertexes as the minimum cost of the paths connecting them.

For each special vertex, find another special vertex which is farthest from it (in terms of the previous paragraph, i.e. the corresponding distance is maximum possible) and output the distance between them.

The original constraints are really small so he thought the problem was boring. Now, he raises the constraints and hopes you can solve it for him.

Input

The first line contains three integers n, m and k (2 ≤ k ≤ n ≤ 10^5, n-1 ≤ m ≤ 10^5) — the number of vertices, the number of edges and the number of special vertices.

The second line contains k distinct integers x_1, x_2, …, x_k (1 ≤ x_i ≤ n).

Each of the following m lines contains three integers u, v and w (1 ≤ u,v ≤ n, 1 ≤ w ≤ 10^9), denoting there is an edge between u and v of weight w. The given graph is undirected, so an edge (u, v) can be used in the both directions.

The graph may have multiple edges and self-loops.

It is guaranteed, that the graph is connected.

Output

The first and only line should contain k integers. The i-th integer is the distance between x_i and the farthest special vertex from it.

Examples

Input

2 3 2
2 1
1 2 3
1 2 2
2 2 1


Output

2 2 


Input

4 5 3
1 2 3
1 2 5
4 2 1
2 3 2
1 4 4
1 3 3


Output

3 3 3 

Note

In the first example, the distance between vertex 1 and 2 equals to 2 because one can walk through the edge of weight 2 connecting them. So the distance to the farthest node for both 1 and 2 equals to 2.

In the second example, one can find that distance between 1 and 2, distance between 1 and 3 are both 3 and the distance between 2 and 3 is 2.

The graph may have multiple edges between and self-loops, as in the first example.
4 4 3
1 2 3
1 2 1
2 3 2
1 3 3
1 4 4
 4 3 2
1 4
1 2 1
2 3 5
3 4 1
 3 2 2
1 2
1 2 1
2 3 47
 3 2 2
1 2
1 2 1
2 3 1000
 3 2 2
1 2
1 2 10
2 3 100
 3 3 2
2 3
1 2 100
1 3 100
2 3 1
 3 2 2
1 2
1 2 2
2 3 3
 6 5 3
1 2 4
1 3 3
3 2 2
2 4 1
3 5 4
5 6 10
 3 2 2
2 3
1 2 10
2 3 1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 4 3 2
3 4
1 2 10000
2 3 10000
3 4 1
 7 6 2
6 7
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
 3 2 2
2 3
1 2 100
2 3 1
 4 3 2
1 2
1 2 1
2 3 12
3 4 123123
 3 2 2
2 1
1 2 1
2 3 100
 3 2 2
2 3
1 2 2
2 3 1
 3 2 2
2 3
1 2 7
2 3 1
 3 2 2
1 2
1 2 1
2 3 3
 3 2 2
1 2
1 2 10
2 3 15
 4 3 2
1 4
1 2 3
2 3 4
3 4 3
 6 5 4
1 2 3 4
1 2 1
2 3 1
3 4 1
4 5 1
5 6 10
 4 3 2
2 3
1 2 1000
2 3 1
3 4 1000
 4 3 2
1 2
1 2 1
2 3 1000
3 4 1000
 3 3 2
1 2
1 2 1
1 3 1000
2 3 1000
 3 2 2
1 2
1 2 3
1 3 5
 4 4 2
3 4
1 2 1000000000
2 3 1000000000
3 1 1000000000
3 4 1
 4 3 2
3 4
1 2 5
2 3 3
2 4 4
 3 2 2
1 2
1 2 3
2 3 100
 3 2 2
2 3
1 2 5
2 3 1
 5 4 2
4 5
1 2 10
2 3 10
3 4 1
3 5 1
 4 3 2
2 3
1 2 100
2 3 1
3 4 100
 4 3 3
1 2 3
1 2 1
3 1 2
4 3 3
 4 3 2
3 4
1 2 100
2 3 2
2 4 2

2 2 2  5 5  1 1  1 1  10 10  1 1  2 2  3 3 3  1 1  1 1  3 3  20 20  5 5 5  2 2 2  3 3  1 1  1 1  1 1  1 1  6 6  1 1  3 3  3 3  2 2  1 1  7 7 7  2 2  1 1  1 1  1 1  1 1  1 1  1 1  20 20 20  1 1  10 10  1 1  3 3  3 3  1000000000 1000000000  5 5 5 5  1 1  1 1  1 1  1 1  1 1  1 1  1 1  1 1  1 1  1 1  10 10  4 4  1 1 1 1  1 1  1 1  1 1  3 3  1 1  4 4  3 3  1 1  1 1  1 1  2 2 2  2 2 

import java.io.*;
import java.util.*;
public class D1081 {
    static int sp[],id[],max=0;static HashMap<Integer,ArrayList<Integer>> map;
    static HashMap<Integer,ArrayList<Integer>> weights;
    static boolean vis[];
    static int find(subset subsets[], int i) 
    { 
        // find root and make root as parent of i (path compression) 
        if (subsets[i].par != i) 
            subsets[i].par = find(subsets, subsets[i].par); 
  
        return subsets[i].par; 
    } 
    static void union(subset subsets[], int x, int y) 
    { 
        int xroot = find(subsets, x); 
        int yroot = find(subsets, y); 
  
        // Attach smaller rank tree under root of high rank tree 
        // (Union by Rank) 
        if (subsets[xroot].rank < subsets[yroot].rank) 
            subsets[xroot].par = yroot; 
        else if (subsets[xroot].rank > subsets[yroot].rank) 
            subsets[yroot].par = xroot; 
  
        // If ranks are same, then make one as root and increment 
        // its rank by one 
        else
        { 
            subsets[yroot].par = xroot; 
            subsets[xroot].rank++; 
        } 
    }  
    public static void main(String args[])throws IOException
    {
        Reader sc=new Reader();
        int n=sc.nextInt();
        int m=sc.nextInt();
        int k=sc.nextInt();
        sp=new int[n+1];
        subset sub[]=new subset[n+1];
        vis=new boolean[n+1];int start=1;
        for(int i=1;i<=k;i++)
        {
            start=sc.nextInt();
            sp[start]=1;
            
        }
        map=new HashMap<>();
        weights=new HashMap<>();
        for(int i=1;i<=n;i++)
        {
            map.put(i,new ArrayList<>());
            weights.put(i,new ArrayList<>());
            sub[i]=new subset();
            sub[i].par=i;
            sub[i].rank=0;
        }
        edge a[]=new edge[m];
        for(int i=0;i<m;i++)
        {
            int x=sc.nextInt();
            int y=sc.nextInt();
            int w=sc.nextInt();
            a[i]=new edge(x,y,w);
        }
        Arrays.sort(a,new Comparator<edge>(){
            public int compare(edge ob1,edge ob2)
            {
                return Integer.compare(ob1.wt,ob2.wt);
            }
        });
        int e=0,i=0;
        while(e<n-1)
        {
            int x=find(sub,a[i].st);
            int y=find(sub,a[i].end);
            if(x!=y)
            {
                e++;
                map.get(a[i].st).add(a[i].end);
                map.get(a[i].end).add(a[i].st);
                weights.get(a[i].st).add(a[i].wt);
                weights.get(a[i].end).add(a[i].wt);
                union(sub,x,y);
                //System.out.println(a[i].st+" "+a[i].end+" "+a[i].wt);
            }
            i++;
        }
        //System.out.println(map);
        //System.out.println(weights);
        dfs(start);
        //int max=0;
        for(i=1;i<=k;i++)
        {
            System.out.print(max+" ");
            //System.out.println(sp[i]);
        }
        
    }
    static void dfs(int ind)
    {
        vis[ind]=true;
        for(int i=0;i<map.get(ind).size();i++)
        {
            int x=map.get(ind).get(i);
            if(!vis[x])
            {
                dfs(x);
                sp[ind]+=sp[x];
                
                if(sp[x]>0)
                {
                    max=Math.max(max,weights.get(ind).get(i));
                    //System.out.println(ind+" "+x+" "+sp[ind]+" "+sp[x]);
                    //System.out.println(weights.get(ind).get(i));
                }
            }
        }
        
    }

}
class subset
{
    int par,rank;
//    public subset(int p,int r)
//    {
//        par=p;
//        rank=r;
//    }
}
class edge
{
    int st,end,wt;
    public edge(int s,int e,int w)
    {
        this.st=s;
        this.end=e;
        this.wt=w;
    }
}


class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte [] buffer;
		private int bufferPointer, bytesRead;
		
		public Reader () {
			din = new DataInputStream (System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		
		public Reader (String file_name) throws IOException {
			din = new DataInputStream (new FileInputStream (file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		
		public String readLine () throws IOException {
			byte [] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read ()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String (buf, 0, cnt);
		}
		
		public int nextInt () throws IOException {
			int ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		
		public long nextLong () throws IOException {
			long ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		
		public double nextDouble () throws IOException {
			double ret = 0, div = 1;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read ()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		
		private void fillBuffer () throws IOException {
			bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		
		private byte read () throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer ();
			return buffer[bufferPointer++];
		}
		
		public void close () throws IOException {
			if (din == null)
				return;
			din.close ();
		}
	}
