#include <bits/stdc++.h>
using namespace std;
struct vode {
  int x;
  int y;
  int z;
} a[100005];
int check[100005];
int father[100005];
int Find(int x) {
  if (father[x] != x) {
    father[x] = Find(father[x]);
  }
  return father[x];
}
bool cmp(vode s1, vode s2) { return s1.z < s2.z; }
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int p;
    scanf("%d", &p);
    check[p] = 1;
  }
  for (int i = 1; i <= n; i++) father[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].z);
  }
  sort(a + 1, a + 1 + m, cmp);
  int ans;
  for (int i = 1; i <= m; i++) {
    int now1 = Find(a[i].x);
    int now2 = Find(a[i].y);
    if (now1 == now2) continue;
    father[now1] = now2;
    if (check[now1] && check[now2]) ans = a[i].z;
    if (check[now1]) check[now2] |= 1;
  }
  for (int i = 1; i <= k; i++) printf("%d ", ans);
  return 0;
}
