#include <bits/stdc++.h>
using namespace std;
const int maxn = 112345;
int n, m, k, p[maxn], cnt[maxn], x;
vector<pair<int, pair<int, int>>> edges;
int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int(i) = (1); (i) <= (k); (i)++) {
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int(i) = (1); (i) <= (m); (i)++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    edges.push_back(make_pair(w, make_pair(u, v)));
  }
  sort((edges).begin(), (edges).end());
  for (int(i) = (1); (i) <= (n); (i)++) p[i] = i;
  int ans = 0;
  for (auto e : edges) {
    int u = Find(e.second.first), v = Find(e.second.second);
    if (u == v) continue;
    p[u] = v;
    if (cnt[u] && cnt[v]) ans = e.first;
    cnt[v] += cnt[u];
  }
  for (int(i) = (1); (i) <= (k); (i)++) printf("%d ", ans);
}
