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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.TreeSet;
                     
                     
                     
                     
                     
                    public class Solution1 implements Runnable
                    {
                        static final long MOD = 998244353;
                        static class InputReader
                        {
                            private InputStream stream;
                            private byte[] buf = new byte[1024];
                            private int curChar;
                            private int numChars;
                            private SpaceCharFilter filter;
                            private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                     
                            public InputReader(InputStream stream)
                            {
                                this.stream = stream;
                            }
                            
                            public int read()
                            {
                                if (numChars==-1) 
                                    throw new InputMismatchException();
                                
                                if (curChar >= numChars)
                                {
                                    curChar = 0;
                                    try 
                                    {
                                        numChars = stream.read(buf);
                                    }
                                    catch (IOException e)
                                    {
                                        throw new InputMismatchException();
                                    }
                                    
                                    if(numChars <= 0)                
                                        return -1;
                                }
                                return buf[curChar++];
                            }
                         
                            public String nextLine()
                            {
                                String str = "";
                                try
                                {
                                    str = br.readLine();
                                }
                                catch (IOException e)
                                {
                                    e.printStackTrace();
                                }
                                return str;
                            }
                            public int nextInt()
                            {
                                int c = read();
                                
                                while(isSpaceChar(c)) 
                                    c = read();
                                
                                int sgn = 1;
                                
                                if (c == '-') 
                                {
                                    sgn = -1;
                                    c = read();
                                }
                                
                                int res = 0;
                                do 
                                {
                                    if(c<'0'||c>'9') 
                                        throw new InputMismatchException();
                                    res *= 10;
                                    res += c - '0';
                                    c = read();
                                }
                                while (!isSpaceChar(c)); 
                                
                                return res * sgn;
                            }
                            
                            public long nextLong() 
                            {
                                int c = read();
                                while (isSpaceChar(c))
                                    c = read();
                                int sgn = 1;
                                if (c == '-') 
                                {
                                    sgn = -1;
                                    c = read();
                                }
                                long res = 0;
                                
                                do 
                                {
                                    if (c < '0' || c > '9')
                                        throw new InputMismatchException();
                                    res *= 10;
                                    res += c - '0';
                                    c = read();
                                }
                                while (!isSpaceChar(c));
                                    return res * sgn;
                            }
                            
                            public double nextDouble() 
                            {
                                int c = read();
                                while (isSpaceChar(c))
                                    c = read();
                                int sgn = 1;
                                if (c == '-') 
                                {
                                    sgn = -1;
                                    c = read();
                                }
                                double res = 0;
                                while (!isSpaceChar(c) && c != '.') 
                                {
                                    if (c == 'e' || c == 'E')
                                        return res * Math.pow(10, nextInt());
                                    if (c < '0' || c > '9')
                                        throw new InputMismatchException();
                                    res *= 10;
                                    res += c - '0';
                                    c = read();
                                }
                                if (c == '.') 
                                {
                                    c = read();
                                    double m = 1;
                                    while (!isSpaceChar(c)) 
                                    {
                                        if (c == 'e' || c == 'E')
                                            return res * Math.pow(10, nextInt());
                                        if (c < '0' || c > '9')
                                            throw new InputMismatchException();
                                        m /= 10;
                                        res += (c - '0') * m;
                                        c = read();
                                    }
                                }
                                return res * sgn;
                            }
                            
                            public String readString() 
                            {
                                int c = read();
                                while (isSpaceChar(c))
                                    c = read();
                                StringBuilder res = new StringBuilder();
                                do 
                                {
                                    res.appendCodePoint(c);
                                    c = read();
                                } 
                                while (!isSpaceChar(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;
                            }
                         
                            public String next() 
                            {
                                return readString();
                            }
                            
                            public interface SpaceCharFilter 
                            {
                                public boolean isSpaceChar(int ch);
                            }
                        }
                         
                        public static void main(String args[]) throws Exception
                        {
                            new Thread(null, new Solution1(),"Solution",1<<26).start();
                        }   
                        static long gcd(long a, long b) 
                        { 
                          if (b == 0) 
                            return a; 
                          return gcd(b, a % b);  
                        } 
                        static long lcm(long a,long b) {
                            return (a*b)/gcd(a,b);
                        }
                        class Node{
                            int a;
                            long val;
                            Node(){
                                
                            }
                            Node(int a,long val){
                                this.a = a;
                                this.val = val;
                            }
                        }
                        ArrayList<Node> adj[];
                        int[] special;
                        TreeSet<Integer> val;
                        public void run() 
                        {
                            InputReader sc = new InputReader(System.in);
                            PrintWriter w = new PrintWriter(System.out);
                            int n = sc.nextInt();
                            int m = sc.nextInt();
                            int k = sc.nextInt();
                            special = new int[k];
                            initialize(n);
                            val = new TreeSet();
                            for(int i = 0;i < k;i++) {
                                special[i] = sc.nextInt();
                                val.add(special[i]);
                            }
                            Pair[] p = new Pair[m];
                            for(int i = 0;i < m;i++) {
                                p[i] = new Pair(sc.nextInt(),sc.nextInt(),sc.nextLong());
                            }
                            Arrays.sort(p);
                            long max = Integer.MIN_VALUE;
                            
                            ArrayList<Pair> navi = new ArrayList();
                            for(int i = 0;i < p.length;i++) {
                                int a = p[i].a-1;
                                int b = p[i].b-1;
                                if(!find(a,b)) {
                                    union(a,b);
                                    adj[a].add(new Node(b,p[i].c));
                                    adj[b].add(new Node(a,p[i].c));
                                    navi.add(new Pair(p[i].a,p[i].b,p[i].c));
                                }
                            }
                            start = new int[n];
                            end = new int[n];
                            visited = new boolean[n];
                            parent = new int[n];
                            flag = new boolean[n];
                            Arrays.fill(flag, false);
                            dfs(0);
                            /*for(int i = 0;i < n;i++) {
                                w.println(start[i] + " " + end[i]);
                            }*/
                            int[] arr = new int[2*n];
                            for(int i = 0;i < n;i++) {
                                arr[start[i]] = i;
                                arr[end[i]] = i;
                            }
                            SegTreeLazy s = new SegTreeLazy(2*n);
                            s.build(0,2*n-1,0, arr);
                            for(int i = 0;i < navi.size();i++) {
                                int x = navi.get(i).a-1;
                                int y = navi.get(i).b-1;
                                if(parent[x] == y && flag[x]) {
                                    s.update(0,2*n-1, 0, start[x]-1, 0, navi.get(i).c);
                                    s.update(0,2*n-1, end[x]+1,2*n-1, 0, navi.get(i).c);
                                }else if(parent[y] == x && flag[y]){
                                    s.update(0,2*n-1, 0, start[y]-1, 0, navi.get(i).c);
                                    s.update(0,2*n-1, end[y]+1,2*n-1, 0, navi.get(i).c);
                                }
                            }
                            for(int i = 0;i < k;i++) {
                                max = Math.max(max,s.query(0,2*n-1, start[special[i]-1],start[special[i]-1],0));
                            }
                            for(int i = 0;i < k;i++) {
                                w.print(max + " ");
                            }
                            w.close();
                        }
                        int[] start;
                        int[] end;
                        int time = 0;
                        boolean[] visited;
                        int[] parent;
                        boolean[] flag;
                        void dfs(int a) {
                            if(val.contains(a+1)) {
                                flag[a] = true;
                            }
                            start[a] = time;
                            time++;
                            visited[a] = true;
                            Iterator<Node> it = adj[a].iterator();
                            while(it.hasNext()) {
                                Node x = it.next();
                                if(!visited[x.a]) {
                                    parent[x.a] = a;
                                    dfs(x.a);
                                    flag[a] = flag[a] | flag[x.a];
                                }
                            }
                            end[a] = time;
                            time++;
                        }
                        static class SegTreeLazy{
                            long[] segTree;
                            long[] lazy;
                            public SegTreeLazy(int n){
                                segTree = new long[4*n];
                                lazy = new long[4*n];
                            }
                            void build(int l,int r,int pos,int[] arr) {
                                if(l == r) {
                                    segTree[pos] = 0;
                                    return;
                                }
                                int mid = (l + r)/2;
                                build(l, mid, 2*pos+1, arr);
                                build(mid+1, r, 2*pos+2, arr);
                                segTree[pos] = Math.max(segTree[2*pos+1],segTree[2*pos+2]);
                            }
                            void update(int l,int r,int start,int end,int pos,long val) {
                                
                                if(lazy[pos] != 0) {
                                    segTree[pos] = Math.max(lazy[pos],segTree[pos]);
                                    if(l != r) {
                                        lazy[2*pos+1] = Math.max(lazy[2*pos+1],lazy[pos]);
                                        lazy[2*pos+2] = Math.max(lazy[2*pos+2],lazy[pos]);
                                    }
                                    lazy[pos] = 0;
                                }
                                if(l > r || l > end || r < start) {
                                    return;
                                }
                                if(l >= start && r <= end) {
                                    segTree[pos] = Math.max(val,segTree[pos]);
                                    if(l != r) {
                                        lazy[2*pos+1] = Math.max(lazy[2*pos+1],val);
                                        lazy[2*pos+2] = Math.max(lazy[2*pos+2],val);
                                    }
                                    return;
                                }
                                int mid = (l + r)/2;
                                update(l, mid, start, end, 2*pos+1, val);
                                update(mid+1, r, start, end, 2*pos+2, val);
                                segTree[pos] = Math.max(segTree[2*pos+1],segTree[2*pos+2]);
                            }
                            long query(int l,int r,int start,int end,int pos) {
                                if(lazy[pos] != 0) {
                                    segTree[pos] = Math.max(lazy[pos],segTree[pos]);
                                    if(l != r) {
                                        lazy[2*pos+1] = Math.max(lazy[2*pos+1],lazy[pos]);
                                        lazy[2*pos+2] = Math.max(lazy[2*pos+2],lazy[pos]);
                                    }
                                    lazy[pos] = 0;
                                }
                                if(l > r || l > end || r < start) {
                                    return 0;
                                }
                                if(l >= start && r <= end) {
                                    return segTree[pos];
                                }
                                int mid = (l + r)/2;
                                long p1 = query(l, mid, start, end, 2*pos+1);
                                long p2 = query(mid+1, r, start, end, 2*pos+2);
                                return Math.max(p1,p2);
                            }
                        }
                        long nCr(int a,int b) {
                            long one = fact[a];
                            long two = (fact[b] * fact[a - b]) % MOD;
                            long three = (one * power(two,MOD-2,MOD)) % MOD;
                            return three;
                        }
                        static long power(long a,long b,long mod) {
                            long ans = 1;
                            a = a % mod;
                            while(b != 0) {
                                if(b % 2 == 1) {
                                    ans = (ans * a) % mod;
                                }
                                a = (a * a) % mod;
                                b = b/2;
                            }
                            return ans;
                        }
                        long[] fact = new long[100005];
                        void pre() {
                            fact[0] = 1;
                            for(int i = 1;i < fact.length;i++) {
                                fact[i] = (fact[i-1] * i) % MOD;
                            }
                        }
                        
                             int[] arr;
                             int[] size;
                            
                             void initialize(int n) {
                                arr = new int[n];
                                size = new int[n];
                                adj = new ArrayList[n];
                                for(int i = 0;i < n;i++) {
                                    arr[i] = i;
                                    size[i] = 1;
                                    adj[i] = new ArrayList();
                                }
                            }
                            
                            int root(int a) {
                                while(arr[a] != a) {
                                    arr[a] = arr[arr[a]];
                                    a = arr[a];
                                }
                                return a;
                            }
                             void union(int a,int b) {
                                int rootA = root(a);
                                int rootB = root(b);
                                if(size[rootA] > size[rootB]) {
                                    arr[rootB] = arr[rootA];
                                    size[rootA] += size[rootB];
                                }
                                else {
                                    size[rootB] += size[rootA];
                                    arr[rootA] = arr[rootB];
                                }
                            }
                            
                             boolean find(int a,int b) {
                                int rootA = root(a);
                                int rootB = root(b);
                                if(rootA == rootB) {
                                    return true;
                                }
                                return false;
                            }
                        
                        class Pair implements Comparable<Pair>{
                            int a;
                            int b;
                            long c;
                            Pair(int a,int b,long c){
                                this.b = b;
                                this.a = a;
                                this.c = c;
                            }
                            public boolean equals(Object o) {
                                Pair p = (Pair)o;
                                return this.a == p.a && this.b == this.b;
                            }
                            public int hashCode(){
                                return Long.hashCode(a)*27 + Long.hashCode(b)*31;
                            }
                            public int compareTo(Pair p) {
                                return Long.compare(this.c,p.c);
                            }
                        }
                        
                    }