#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 1000010;
const int INF = 2147483600;
struct data {
  int x, y, val;
} a[MAXN + 1];
int fa[MAXN + 1], s[MAXN + 1], vis[MAXN + 1], N, M, Kf, flag;
bool cmp(data x, data y) { return x.val < y.val; }
inline int find(int x) { return (x == fa[x] ? x : (fa[x] = find(fa[x]))); }
inline void merge(int x, int y) {
  int X = find(x), Y = find(y);
  if (X == Y) return;
  fa[X] = Y;
  s[Y] += s[X];
  if (s[Y] == Kf) flag = 1;
}
inline void solve() {
  for (int i = 1; i <= M; i++) {
    merge(a[i].x, a[i].y);
    if (flag == 1) {
      for (int j = 1; j <= Kf; j++) cout << a[i].val << " ";
      return;
    }
  }
  for (int i = 1; i <= M; i++) {
    merge(a[i].x, a[i].y);
    if (flag == 1) {
      for (int j = 1; j <= Kf; j++) cout << a[i].val << " ";
      return;
    }
  }
  for (int i = 1; i <= M; i++) {
    merge(a[i].x, a[i].y);
    if (flag == 1) {
      for (int j = 1; j <= Kf; j++) cout << a[i].val << " ";
      return;
    }
  }
}
int main() {
  N = read(), M = read(), Kf = read();
  for (int i = 1; i <= Kf; i++) {
    int x = read();
    vis[x] = 1;
  }
  for (int i = 1; i <= N; i++) {
    fa[i] = i;
    if (vis[i]) s[i] = 1;
  }
  for (int i = 1; i <= M; i++)
    a[i].x = read(), a[i].y = read(), a[i].val = read();
  sort(a + 1, a + M + 1, cmp);
  solve();
  return 0;
}
