#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long mod = 1e9 + 7;
vector<pair<int, pair<int, int> > > v;
int fa[N];
bool vis[N], s[N];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
inline void short_tree(int n, int k) {
  sort(v.begin(), v.end());
  for (int i = 1; i <= n; i++) fa[i] = i;
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    int w = v[i].first;
    int u = v[i].second.first;
    int vv = v[i].second.second;
    int fu = find(u);
    int fv = find(vv);
    fa[fu] = fv;
    if (fu == fv) continue;
    if (s[fu] && s[fv])
      ans = max(ans, w);
    else if (s[fu] || s[fv])
      s[fu] = s[fv] = 1;
  }
  for (int i = 1; i <= k; i++) printf("%d ", ans);
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    vis[x] = true;
    s[x] = true;
  }
  while (m--) {
    int uu, vv, ww;
    scanf("%d%d%d", &uu, &vv, &ww);
    v.push_back(make_pair(ww, make_pair(uu, vv)));
  }
  short_tree(n, k);
}
