#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
struct node {
  long long int u, v, w;
} edge[N];
bool cmp(node a, node b) { return a.w < b.w; }
long long int n, m, k, v, ans = 0;
bool special[N];
long long int root[N];
long long int find_root(long long int x) {
  if (root[x] == x) return x;
  return root[x] = find_root(root[x]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (long long int i = 0; i <= k - 1; ++i) {
    cin >> v;
    special[v] = true;
  }
  for (long long int i = 0; i <= m - 1; ++i) {
    cin >> edge[i].u >> edge[i].v >> edge[i].w;
  }
  sort(edge, edge + m, cmp);
  for (long long int i = 1; i <= n; ++i) root[i] = i;
  for (long long int i = 0; i <= m - 1; ++i) {
    long long int root_u = find_root(edge[i].u);
    long long int root_v = find_root(edge[i].v);
    if (root_u != root_v) {
      if (special[root_u] && special[root_v]) {
        ans = max(ans, edge[i].w);
      }
      if (special[root_u])
        root[root_v] = root_u;
      else
        root[root_u] = root_v;
    }
  }
  for (long long int j = 1; j <= n; ++j) {
    if (special[j]) cout << ans << " ";
  }
  return 0;
}
