#include <bits/stdc++.h>
const int N = (int)1e5 + 5;
struct info {
  int l, r, w;
  inline bool operator<(const info &x) const { return this->w < x.w; }
} E[N];
int n, m, k, x, y, z, fa[N];
bool spe[N];
int get_fa(int x) { return (fa[x] == x) ? x : fa[x] = get_fa(fa[x]); }
inline int kruscal() {
  int ret = 0;
  std::sort(E + 1, E + 1 + m);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int fx = get_fa(E[i].l), fy = get_fa(E[i].r);
    if (fx == fy) continue;
    fa[fx] = fy;
    if (spe[fx] || spe[fy]) {
      if (spe[fx] && spe[fy]) ret = E[i].w;
      spe[fx] = spe[fy] = true;
    }
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &x), spe[x] = true;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &x, &y, &z);
    if (x == y) continue;
    E[i].l = x, E[i].r = y, E[i].w = z;
  }
  int res = kruscal();
  while (k--) printf("%d ", res);
  puts("");
  return 0;
}
