#include <bits/stdc++.h>   using namespace std;   const int MAX = 100005;   const int MOD = 1000000007;   unordered_map<int, bool> sp;   vector<int> g[MAX];   struct node {     int u, v;     int cost;     node(int _u, int _v, int _cost) {       u = _u;       v = _v;       cost = _cost;     }   };   bool mst_sort(node &a, node &b) { return a.cost < b.cost; }   bool ans_sort(node &a, node &b) { return a.cost > b.cost; }   vector<node> e;   int par[MAX];   int findpar(int r) {     if (par[r] == r) return r;     par[r] = findpar(par[r]);     return par[r];   }   vector<node> tree;   void mst(int n) {     for (int i = 0; i < n; i++) par[i] = i;     sort(e.begin(), e.end(), mst_sort);     int c = 0;     for (int i = 0; i < e.size(); i++) {       int u = findpar(e[i].u);       int v = findpar(e[i].v);       if (u != v) {         par[u] = v;         tree.push_back(e[i]);         g[e[i].u].push_back(e[i].v);         g[e[i].v].push_back(e[i].u);         c++;         if (c == n - 1) break;       }     }     return;   }   int can[MAX];   map<pair<int, int>, bool> vis;   bool dfs(int n, int par) {     if (sp[n]) return can[n] = true;     if (vis[pair<int, int>(n, par)]) return can[n] = false;     if (can[n] != -1) return can[n];     bool ret = false;     for (int i : g[n]) {       if (i != par) ret |= dfs(i, n);       if (ret) return can[n] = ret;     }     return can[n] = ret;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     ;     int n, m, k;     cin >> n >> m >> k;     for (int i = 0; i < k; i++) {       int temp;       cin >> temp;       sp[temp] = true;     }     while (m--) {       int u, v, cost;       cin >> u >> v >> cost;       e.push_back(node(u, v, cost));     }     mst(n);     sort(tree.begin(), tree.end(), ans_sort);     int ans = 0;     memset(can, -1, sizeof can);     for (int i = 0; i < tree.size(); i++) {       node p = tree[i];       if (sp[p.u] && sp[p.v]) {         ans = p.cost;         break;       }       if (sp[p.u]) {         can[p.v] = -1;         if (dfs(p.v, p.u)) {           ans = p.cost;           break;         }       } else if (sp[p.v]) {         can[p.u] = -1;         if (dfs(p.u, p.v)) {           ans = p.cost;           break;         }       } else {         can[p.u] = can[p.v] = -1;         if (dfs(p.u, p.v) && dfs(p.v, p.u)) {           ans = p.cost;           break;         }       }       vis[pair<int, int>(p.u, p.v)] = true;     }     for (int i = 0; i < k; i++) cout << ans <<    ;     cout <<   n ;   }   