#include <bits/stdc++.h>
using namespace std;
const long long mx = 1e5 + 1;
vector<long long> par(mx);
long long find(long long a) {
  if (a != par[a]) par[a] = find(par[a]);
  return par[a];
}
int main() {
  vector<long long> size(mx);
  long long n, m, k, u, v, w, a, b, x, y;
  cin >> n >> m >> k;
  vector<long long> spnode(k);
  for (long long i = 0; i < k; i++) {
    cin >> spnode[i];
    size[spnode[i]]++;
  }
  vector<tuple<long long, long long, long long>> edge(m);
  for (long long i = 0; i < m; i++) {
    cin >> u >> v >> w;
    edge[i] = make_tuple(w, u, v);
  }
  sort(edge.begin(), edge.end());
  for (long long i = 1; i <= n; i++) par[i] = i;
  for (long long i = 0; i < m; i++) {
    a = get<1>(edge[i]);
    b = get<2>(edge[i]);
    a = find(a);
    b = find(b);
    if (a == b) continue;
    if (size[a] + size[b] == k) {
      for (long long j = 0; j < k; j++) cout << get<0>(edge[i]) << ' ';
      cout << endl;
      break;
    }
    size[b] += size[a];
    par[find(a)] = find(b);
  }
  return 0;
}
