#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> operator+(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
pair<long long, long long> operator-(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
pair<long long, long long> operator*(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return make_pair(a.first * b.first, a.second * b.second);
}
pair<long long, long long> operator%(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return make_pair(a.first % b.first, a.second % b.second);
}
template <class T>
inline T lowbit(T x) {
  return x & (-x);
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1e5 + 10;
int n, m, k, v[N];
bool flg[N];
struct edge {
  int u, v, w;
} e[N];
bool comp(edge a, edge b) { return a.w < b.w; };
struct ufset {
  int par[N], siz[N], cnt[N], ans[N];
  void init(int n) {
    for (int i = (1); i <= (n); i++) par[i] = i, siz[i] = 1, cnt[i] = flg[i];
  }
  int find(int u) { return par[u] == u ? u : par[u] = find(par[u]); }
  void unite(int u, int v) {
    u = find(u);
    v = find(v);
    if (u == v) return;
    par[u] = v;
    siz[v] += siz[u];
    cnt[v] += cnt[u];
  }
  bool same(int u, int v) { return find(u) == find(v); }
} s, t;
int main() {
  n = read();
  m = read();
  k = read();
  for (int i = (1); i <= (k); i++) flg[v[i] = read()] = 1;
  for (int i = (1); i <= (m); i++) {
    e[i].u = read();
    e[i].v = read();
    e[i].w = read();
  }
  s.init(n);
  t.init(n);
  sort(e + 1, e + 1 + m, comp);
  bool b = 0;
  for (int i = (1); i <= (m); i++) {
    int u = e[i].u, v = e[i].v;
    if (s.same(u, v)) continue;
    if (b) {
      if (s.cnt[s.find(u)] == k)
        t.ans[t.find(v)] = e[i].w;
      else if (s.cnt[s.find(v)] == k)
        t.ans[t.find(u)] = e[i].w;
      else
        t.unite(u, v);
    } else if (s.cnt[s.find(u)] + s.cnt[s.find(v)] == k) {
      b = 1;
      t.ans[t.find(u)] = t.ans[t.find(v)] = e[i].w;
    }
    s.unite(u, v);
    if (!b) t.unite(u, v);
    if (s.siz[s.find(u)] == n) break;
  }
  for (int i = (1); i <= (k); i++) printf("%d ", t.ans[t.find(v[i])]);
}
