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 
/*

     _____________    _____________    _____________	          _____________    _____________
    (  ___________)  |  _________  )  (___________  )	         (___________  )  (  ___________)
    ( (		     | |         | )	          | )            	     ) )  ( (
    ( (___________   | |_________| )   ___________| )	          ___________) )  ( (___________
    (___________  )  |  ___________)  |  _________  )            (  ___________)  (  _________  )
                ) )  | |	      | |         | )  	         ( (              ( (         ) )
     ___________) )  | |___________   | |_________| )   ______   ( (___________   ( (_________) )
    (_____________)  |_____________)  |_____________)  (______)  (_____________)  (_____________)



    Name  : Abdus Sahid
    Don't give up until the last second.

    Topcoder handle : sea_26
    Codechef handle : sea_26

    Practice makes a man perfect.

*/

#pragma GCC optimize("03")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;


template< typename T>
    using Ordered_Set = tree<int, null_type, T,
        rb_tree_tag, tree_order_statistics_node_update>;


using ll = long long;
using ld = long double;

typedef pair<int, int> PII;
typedef pair<ll, int> PLI;
typedef pair<int, ll> PIL;
typedef pair<ll, ll> PLL;
typedef pair<string, int> PSI;

typedef map<int, int> MII;
typedef map<ll, ll> MLL;
typedef map<PII, int> MPIII;
typedef map<string, int> MSI;

const ll M = 1e9 + 7;
const ll M2 = 998244353;
const int Iinf = 0x3f3f3f3f;
const ll Linf = 0x3f3f3f3f3f3f3f3f;
const ld PI = acos(-1.0);
// const double pi = atan2(0, -1);
// const double PI = 4 * atan(1);
// const double pi = 2*cos(0.0);

#define mp make_pair
#define eb emplace_back
#define pf push_front
#define pb push_back
#define ppb pop_back()
#define fbo(ind) find_by_order(ind)
#define ook(val) order_of_key(val)
#define f first
#define s second
#define sz size()

#define bp(n) __builtin_popcount(n)
#define bclz(n) __builtin_clz(n)
#define bctz(n) __builtin_ctzll(n)
#define bip(n) __builtin_parity(n)

#define All(v) (v).begin(),(v).end()
#define Rall(v) (v).rbegin(),(v).rend()
#define rvs(v) sort(All(v),greater<int>())
#define mnv(v) *min_element(All(v))
#define mxv(v) *max_element(All(v))
#define acm(v, ini) accumulate(All(v),ini)
#define smp(container, element) (container.find(element) != container.end())
#define vp(container, element) (find(All(container),element) != container.end())

#define ub(v, k) upper_bound(all(v), k) - v.begin()
#define lb(v, k) lower_bound(all(v), k) - v.begin()
#define msz(a) memset(a, 0, sizeof(a))
#define msm(a) memset(a, 0xff, sizeof(a))
#define fpre(n) fixed << setprecision(n)
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define sea template< typename T
#define tc int tt; cin >> tt; for(int t=1; t<=tt; t++)

#define Rep(i, n) for(__typeof(n) i=0; i<n; i++)
#define Per(i, n) for(__typeof(n) i=n-1; i>=0; i--)
#define Lrep(i, p, q) for(__typeof(q) i=p; i<=q; i++)
#define Perl(i, p, q) for(__typeof(p) i=p; i>=q; i--)
#define IT(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define RIT(it, x) for(__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

const int dx4[] = { +1, -1, +0, +0 };
const int dy4[] = { +0, +0, +1, -1 };
const int dx8[] = { +0, +0, +1, -1, -1, +1, -1, +1 };
const int dy8[] = { -1, +1, +0, +0, +1, +1, -1, -1 };

sea > using V = vector<T>;
sea > using VV = vector<vector<T> >;
sea > using MinHeap = priority_queue<T, vector<T>, greater<T> >;

sea > inline bool Checkbit(T n, T Pos){ return n & (1 << Pos); }
sea > inline int Resetbit(T n, T Pos){ return n | (1 << Pos); }
sea > inline int Unsetbit(T n, T Pos){ return n & ~(1 << Pos); }
sea > inline int Flipbit(T n, T Pos){ return n ^ (1 << Pos); }

sea > inline T Max(T a, T b){ return a ^ ((a ^ b) & -(a < b)); }
sea > inline T Min(T a, T b){ return b ^ ((a ^ b) & -(a < b)); }
sea > inline void Swap(T &a, T &b){ a = ((a) ^= (b)),  b = ((b) ^= (a)),  a = ((a) ^= (b)); }
sea > inline T Sqr(T x){ return (x) * (x); }
sea > inline bool IsPoT(T x){ return (x != 0 and (x&(x - 1)) == 0); }

sea > bool Chkmax(T &a, const T b){ if(a < b){a = b; return true;} else return false; }
sea > bool Chkmin(T &a, const T b){ if(a > b){a = b; return true;} else return false; }
sea > V<T> Compress(V<T> A){ sort(all(A)); A.erase(unique(all(A)), A.end()); return A;}

sea > T Gcd(T a, T b){ while(b) b ^= a ^= b ^= a %= b; return a; }
sea > T Exgcd(T a, T b, T& x, T& y){ if(!b){ x = 1; y = 0;return a;} else{ T g = Exgcd(b, a%b, y, x); y -= (a/b)*x; return g;}}
sea > inline T Lcm(T a, T b){ return (a / Gcd(a, b)) * b; }

sea > T Powmod(T n, T p, T M){ n %= M; T Res = 1; while(p > 0){ if(p & 1) Res = ((Res%M)*(n%M))%M; n = ((n%M)*(n%M))%M; p >>= 1; } return Res;}  /// (n^p) % M
sea > T ModInv(T a, T m){ return Powmod(a, m-2, m); }
sea > T Mulmod(T a, T b, T M){ T x = 0, y = a % M; while(b > 0){ if(b&1) x = (x + y) % M; } y = (y << 1) % M; b >>= 1; }  /// (a*b) % M

static inline bool Is_digit(char c){ return static_cast<unsigned char>(c - '0') < 10; }
static inline bool Is_upper(char c){ return static_cast<unsigned char>(c - 'A') < 26; }
static inline bool Is_lower(char c){ return static_cast<unsigned char>(c - 'a') < 26; }

namespace Input{
    sea > inline void read(T& x){
        bool Negative = false; register int c; x = 0; c = getchar();
        if(c == '-'){ Negative = true; c = getchar(); }
        for(; (c > 47 and c < 58); c = getchar()) x = (x << 3) + (x << 1) + c - 48; if(Negative) x *= -1;
    }
    sea, class... Ts> void read(T& t, Ts&... ts){ read(t); read(ts...); }
    sea > istream &operator>>(istream &is, vector<T> &vec){ for(auto &v : vec) is >> v; return is; }
}
using namespace Input;

inline void Add(int &a, int b){ a += b; if(a >= M) a -= M;}
inline void Sub(int &a, int b){ a -= b; if(a < 0) a += M;}
inline int Mul(int a, int b){ return (int)((long long) a * b % M);}


void Out(void){
    cout << "wtf!" << endl;
}

void ReadInput(void){
    //read();
}


class UF{
private:
    V<int> Par;
    V<int> Rank;
public:
    UF(int N){
        Par.assign(N, 0);
        Rank.assign(N, 0);
        Rep(i, N) Par[i] = i;
    }
    inline int Find(int x){ return Par[x] == x ? x : Par[x] = Find(Par[x]); }
    bool IsSame(int x, int y){ return Find(x) == Find(y); }
    void Unite(int x, int y){
        if(!IsSame(x, y)){
            x = Find(x);
            y = Find(y);
            if(Rank[x] < Rank[y]) Swap(x, y);
            Par[y] = x;
            if(Rank[x] == Rank[y]) Rank[x]++;
        }
    }
};

class MaximumDistance{
public:
    void Solve(istream& cin, ostream& cout){
        ReadInput();

        int n, m, k;
        cin >> n >> m >> k;
        V<int> siz(n, 0);
        UF SU(n);
        Rep(i, k){
            int x;
            cin >> x;
            --x;
            siz[x] = 1;
        }

        V<tuple<int, int, int>> tup(m);
        Rep(i, m){
            int u, v, w;
            cin >> u >> v >> w;
            --u;
            --v;
            tup[i] = make_tuple(w, u, v);
        }

        sort(All(tup));
        for(auto tp: tup){
//            int w = get<0>(tp);
//            int u = get<1>(tp);
//            int v = get<2>(tp);
            int w, u, v;
            tie(w, u, v) = tp;
            if(!SU.IsSame(u, v)){
                SU.Unite(u, v);
                siz[v] += siz[u];
                if(siz[v] == k){
                    Rep(i, k) cout << w << " ";
                    exit(0);
                }
            }
        }
    }
};


signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

#ifdef LOCAL_DEFINE
    auto start_time = clock();
#endif // LOCAL_DEFINE

#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
#endif // LOCAL_DEFINE

    MaximumDistance Problem;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    Problem.Solve(in, out);

#ifdef LOCAL_DEFINE
    auto end_time = clock();
        cerr << "\nTime Elapsed: " << fpre(3) << 1.0 * (end_time - start_time) / CLOCKS_PER_SEC  << " Sec"<< endl;
#endif // LOCAL_DEFINE

    return 0;
}
