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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.SplittableRandom;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public final long oo = Long.MAX_VALUE >> 2;

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            Debug debug = new Debug(out);
            int n = in.nextInt();
            int m = in.nextInt();
            int K = in.nextInt();
            int[] x = in.nextIntArray(K);
            int[] xx = Arrays.copyOf(x, x.length);
            MiscUtils.decreaseByOne(x);
            x = ArrayUtils.sort(x);

            TaskD.Edge[] edges = new TaskD.Edge[m];
            for (int i = 0; i < m; ++i) {
                int u = in.nextInt() - 1;
                int v = in.nextInt() - 1;
                long w = in.nextLong();
                if (u > v) {
                    int t = u;
                    u = v;
                    v = t;
                }
                edges[i] = new TaskD.Edge(u, v, w);
            }
            edges = unique(edges);
            Arrays.sort(edges, new Comparator<TaskD.Edge>() {

                public int compare(TaskD.Edge o1, TaskD.Edge o2) {
                    return Long.compare(o1.w, o2.w);
                }
            });

            DJSet ds = new DJSet(n);
            long[] isLoop = new long[n];
            ArrayUtils.fill(isLoop, oo);
            TaskD.Edge[] inMST = new TaskD.Edge[m];
            int ptr = 0;
            for (TaskD.Edge cur : edges) {
                if (cur.u == cur.v) isLoop[cur.u] = Math.min(isLoop[cur.u], cur.w);
                if (ds.union(cur.u, cur.v)) {
                    inMST[ptr++] = cur;
                }
            }
            inMST = Arrays.copyOf(inMST, ptr);

            for (int i = 0; i < n; ++i) if (isLoop[i] == oo) isLoop[i] = -1;

            List<Integer>[] g = new List[n];
            for (int i = 0; i < n; ++i) g[i] = new ArrayList<>();

            for (TaskD.Edge edge : inMST) {
                int u = edge.u;
                int v = edge.v;
                g[u].add(v);
                g[v].add(u);
            }

            long ans = 0;
            EulerTour eulerTour = new EulerTour(g);
            SegmentTreeSum segmentTreeSum = new SegmentTreeSum(n);
            int[] begin = eulerTour.begin;
            int[] end = eulerTour.end;
            int[] discover = eulerTour.discover;
            for (int ind : x) segmentTreeSum.update(discover[ind], 1);
            for (TaskD.Edge cur : inMST) {
                boolean flag = false;
                if (firstInsideSecond(begin, end, cur.u, cur.v)) {
                    long incU = segmentTreeSum.getRangeSum(begin[cur.u], end[cur.u]);
                    if (incU != 0 && K - incU != 0) flag = true;
                } else if (firstInsideSecond(begin, end, cur.u, cur.v)) {
                    long incV = segmentTreeSum.getRangeSum(begin[cur.v], end[cur.v]);
                    if (incV != 0 && K - incV != 0) flag = true;
                } else {
                    long incU = segmentTreeSum.getRangeSum(begin[cur.u], end[cur.u]);
                    if (incU != 0 && K - incU != 0) flag = true;
                    long incV = segmentTreeSum.getRangeSum(begin[cur.v], end[cur.v]);
                    if (incV != 0 && K - incV != 0) flag = true;
                }
                if (flag) ans = Math.max(ans, cur.w);
            }

            boolean first = true;
            for (int xxx : xx) {
                if (!first) out.print(" ");
                first = false;
                out.print(Math.max(isLoop[xxx - 1], ans));
            }
            out.println();
        }

        private boolean firstInsideSecond(int[] begin, int[] end, int u, int v) {
            return begin[u] >= begin[v] && end[u] <= end[v];
        }

        public static TaskD.Edge[] unique(TaskD.Edge[] edges) {
            Arrays.sort(edges);
            int m = edges.length;
            TaskD.Edge[] edges1 = new TaskD.Edge[m];
            int ptr = 0;
            for (int i = 0; i < m; ) {
                int j = i;
                while (j < m && edges[i].u == edges[j].u && edges[i].v == edges[j].v) ++j;
                edges1[ptr++] = new TaskD.Edge(edges[i].u, edges[i].v, edges[i].w);
                i = j;
            }
            edges1 = Arrays.copyOf(edges1, ptr);
            return edges1;
        }

        static class Edge implements Comparable<TaskD.Edge> {
            int u;
            int v;
            long w;

            public Edge(int u, int v, long w) {
                this.u = u;
                this.v = v;
                this.w = w;
            }

            public int compareTo(TaskD.Edge o) {
                if (u != o.u) return u - o.u;
                if (v != o.v) return v - o.v;
                return Long.compare(w, o.w);
            }

            public String toString() {
                return "Edge{" +
                        "u=" + u +
                        ", v=" + v +
                        ", w=" + w +
                        '}';
            }

        }

    }

    static class Debug {
        PrintWriter out;
        boolean oj;
        boolean system;
        long timeBegin;
        Runtime runtime;

        public Debug(PrintWriter out) {
            oj = System.getProperty("ONLINE_JUDGE") != null;
            this.out = out;
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

        public Debug() {
            system = true;
            oj = System.getProperty("ONLINE_JUDGE") != null;
            OutputStream outputStream = System.out;
            this.out = new PrintWriter(outputStream);
            this.timeBegin = System.currentTimeMillis();
            this.runtime = Runtime.getRuntime();
        }

    }

    static class DJSet {
        public int[] upper;
        public int count;

        public DJSet(int n) {
            upper = new int[n];
            count = n;
            Arrays.fill(upper, -1);
        }

        public int root(int x) {
            return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
        }

        public boolean union(int x, int y) {
            x = root(x);
            y = root(y);
            if (x != y) {
                if (upper[y] < upper[x]) {
                    int d = x;
                    x = y;
                    y = d;
                }
                upper[x] += upper[y];
                upper[y] = x;
                --count;
                return true;
            }
            return false;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        public long nextLong() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static class ArrayUtils {
        public static int[] sort(int[] a) {
            a = shuffle(a, new SplittableRandom());
            Arrays.sort(a);
            return a;
        }

        public static int[] shuffle(int[] a, SplittableRandom gen) {
            for (int i = 0, n = a.length; i < n; i++) {
                int ind = gen.nextInt(n - i) + i;
                int d = a[i];
                a[i] = a[ind];
                a[ind] = d;
            }
            return a;
        }

        public static void fill(long[] array, long value) {
            Arrays.fill(array, value);
        }

    }

    static class EulerTour {
        public int[] discover;
        public int[] begin;
        public int[] end;
        public int[] level;
        public int[] parent;
        public int[] indexes;

        public EulerTour(List<Integer>[] g) {
            int n = g.length;
            int[] stack = new int[n];
            int pos = 0;
            discover = new int[n];
            begin = new int[n];
            end = new int[n];
            level = new int[n];
            parent = new int[n];
            indexes = new int[n];
            boolean[] visited = new boolean[n];
            stack[pos++] = 0;
            level[0] = 0;
            parent[0] = -1;
            int clock = 0;
            int count = 0;
            outer:
            while (pos != 0) {
                int cur = stack[pos - 1];
                if (!visited[cur]) {
                    begin[cur] = clock++;
                    discover[count++] = cur;
                    visited[cur] = true;
                }
                while (indexes[cur] < g[cur].size()) {
                    int next = g[cur].get(indexes[cur]++);
                    if (parent[cur] != next) {
                        parent[next] = cur;
                        level[next] = level[cur] + 1;
                        stack[pos++] = next;
                        continue outer;
                    }
                }
                pos--;
                if (indexes[cur] == g[cur].size()) end[cur] = clock - 1;
            }
        }

    }

    static class SegmentTreeSum {
        int[] lazy;
        int[] seg;
        int[] a;
        int size;
        int N;

        public SegmentTreeSum(int[] a) {
            this.N = a.length;
            size = 4 * N;
            seg = new int[size];
            lazy = new int[size];
            this.a = a;
            build(0, N - 1, 0);
        }

        public SegmentTreeSum(int n) {
            this.N = n;
            size = 4 * n;
            seg = new int[size];
            lazy = new int[size];
            a = new int[n];
            build(0, N - 1, 0);
        }

        private void build(int s, int e, int c) {
            if (s == e) {
                seg[c] = a[s];
                return;
            }
            int m = (s + e) >>> 1;
            build(s, m, 2 * c + 1);
            build(m + 1, e, 2 * c + 2);
            seg[c] = seg[2 * c + 1] + seg[2 * c + 2];
        }

        public void update(int index, int value) {
            update(0, N - 1, 0, index, value);
        }

        private void update(int s, int e, int c, int index, int value) {
            if (s == e) {
                seg[c] += value;
                return;
            }
            int m = (s + e) >>> 1;
            if (index <= m) {
                update(s, m, 2 * c + 1, index, value);
            } else {
                update(m + 1, e, 2 * c + 2, index, value);
            }
            seg[c] = seg[2 * c + 1] + seg[2 * c + 2];
        }

        public long getRangeSum(int l, int r) {
            return getRangeSum(0, N - 1, 0, l, r);
        }

        private long getRangeSum(int s, int e, int c, int l, int r) {
            if (s > e || l > r || l > e || r < s) return 0;
            if (lazy[c] != 0) {
                if (s != e) {
                    lazy[2 * c + 1] += lazy[c];
                    lazy[2 * c + 2] += lazy[c];
                }
                seg[c] += (e - s + 1) * lazy[c];
                lazy[c] = 0;
            }
            if (s == e) {
                return seg[c];
            }
            if (s >= l && e <= r) {
                return seg[c];
            }
            int m = (s + e) >>> 1;
            return getRangeSum(s, m, 2 * c + 1, l, r)
                    + getRangeSum(m + 1, e, 2 * c + 2, l, r);
        }

    }

    static class MiscUtils {
        public static void decreaseByOne(int[]... arrays) {
            for (int[] array : arrays) {
                for (int i = 0; i < array.length; i++) {
                    array[i]--;
                }
            }
        }

    }
}

