#include <bits/stdc++.h>
using namespace std;
long long int x[200005], sz[200005], check[200005], p = 0;
void initialize(long long int n) {
  for (long long int i = 1; i <= n; i++) {
    x[i] = i;
    sz[i] = 1;
    check[i] = 0;
  }
}
long long int root(long long int a) {
  if (x[a] != a) {
    x[a] = root(x[a]);
  }
  return x[a];
}
void setunion(long long int a, long long int b) {
  long long int root1 = root(a);
  long long int root2 = root(b);
  if (sz[root1] > sz[root2]) {
    x[root2] = x[root1];
    sz[root1] += sz[root2];
    check[root1] += check[root2];
    p = max(p, check[root1]);
  } else {
    x[root1] = x[root2];
    sz[root2] += sz[root1];
    check[root2] += check[root1];
    p = max(p, check[root2]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int t;
  t = 1;
  while (t--) {
    long long int n, m, k, a, b, c, ans, i;
    cin >> n >> m >> k;
    initialize(n);
    vector<pair<long long int, pair<long long int, long long int> > > v;
    for (i = 1; i <= k; i++) {
      cin >> a;
      check[a] = 1;
    }
    for (i = 0; i < m; i++) {
      cin >> a >> b >> c;
      v.push_back({c, {a, b}});
    }
    sort(v.begin(), v.end());
    ans = 0;
    for (i = 0; i < m; i++) {
      if (p == k) {
        break;
      }
      c = v[i].first;
      a = v[i].second.first;
      b = v[i].second.second;
      if (root(a) != root(b)) {
        ans = max(ans, c);
        setunion(a, b);
      }
    }
    for (i = 1; i <= k; i++) {
      cout << ans << " ";
    }
  }
}
