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 
/*
 * 
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology 
 * 
 */


import java.util.*;
import java.io.*;
import java.lang.*;

public class Code4
{
	public static int n;
	public static int m;
	public static int k;
	public static pair[] edges;
	public static int[] id;
	public static boolean[] isSpecial;
	public static void initialize()
	{
		id = new int[n+1];
		for(int i=0;i<=n;i++)
			id[i] = i;
	}
	
	public static int root(int x)
	{
		while(id[x]!=x)
		{
			id[x] = id[id[x]];
			x = id[x];
		}
		return x;
	}
	
	public static void union(int u,int v)
	{
		int a = root(u);
		int b = root(v);
		id[a] = id[b];
	}

	public static long mst()
	{
		initialize();
		Arrays.sort(edges);
		int count = 0;
		boolean[] visited = new boolean[n+1];
		for(int i=0;i<m;i++)
		{
			int u = edges[i].x;
			int v = edges[i].y;
			long z = edges[i].z;
			
			if(root(u)!=root(v))
			{
				if(isSpecial[u] && !visited[u])
				{
					visited[u] = true;
					count++;
				}
				if(isSpecial[v] && !visited[v])
				{
					visited[v] = true;
					count++;
				}
				union(u,v);
				if(count==k)
					return z;
			}
		}
		return 0;
	}
	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		n = in.nextInt();
		m = in.nextInt();
		k = in.nextInt();
		isSpecial = new boolean[n+1];
		for(int i=0;i<k;i++)
			isSpecial[in.nextInt()] = true;
 		edges = new pair[m];
		id =  new int[n+1];
		
		for(int i=0;i<m;i++)
		{
			int u = in.nextInt();
			int v = in.nextInt();
			int w = in.nextInt();
			edges[i] = new pair(u,v,w);	
		}
		long ans = mst();
		for(int i=0;i<k;i++)
			pw.print(ans +  " ");
		pw.flush();
		pw.close();
	}
	
	static class InputReader 
	{
		 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) 
		{
			this.stream = stream;
		}
 
		public int snext() 
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) 
			{
				curChar = 0;
				try 
				{
					snumChars = stream.read(buf);
				} 
				catch (IOException e) 
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() 
	    {
			int c = snext();
			while (isSpaceChar(c)) 
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do 
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c)) 
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do 
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) 
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++) 
			{
				a[i] = nextInt();
			}
			return a;
		}
 
		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c)) 
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do 
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() 
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do 
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) 
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) 
		{
			return c == '\n' || c == '\r' || c == -1;
		}
 
		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}
	
	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;
	
	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}
	
	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}
	
	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}
	
	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;
		
		isPrime[0] = false;
		isPrime[1] = false;
		
		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}
	
	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}
	
	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}
	
	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}
	
	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}
	
	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}
	
	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}
	
	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}
	
	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}
	
	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}
	
	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}
	
	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}
	
	public static boolean isPrime(int n)
	{
	    
	    if (n <= 1)  return false;
	    if (n <= 3)  return true;
	    
	    if (n%2 == 0 || n%3 == 0) 
	    	return false;
	 
	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }
	    
	    return true;
	}
	
	static class pair implements Comparable<pair>
	{
		Integer x, y;
		Long z;
		pair(int x,int y,long z)
		{
			this.x=x;
			this.y=y;
			this.z=z;
		}
		
		public int compareTo(pair o) {
			int result = z.compareTo(o.z);
			if(result==0)
				result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);
			
			return result;
		}  
		
		public String toString()
		{
			return x+" "+y + " " +z;
		}
		
		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return (Math.abs(p.x-x)==0 && Math.abs(p.y-y)==0 && Math.abs(p.z-z)==0);
			}
			return false;
		}
		
		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode() + new Long(z).hashCode();
		}
	}
}