#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u;
  int v;
  int c;
};
bool compare(edge e, edge u) { return e.c < u.c; }
int findparent(int parent[], int u) {
  int p = parent[u];
  if (p == u) {
    return p;
  }
  int fp = findparent(parent, p);
  if (p == fp) {
    return fp;
  }
  parent[u] = fp;
  return parent[u];
}
int mc = -1;
void uni(int special[], int parent[], int u, int v, int c) {
  int up = findparent(parent, u);
  int vp = findparent(parent, v);
  if (vp == up) {
    return;
  }
  parent[up] = vp;
  if (special[up] != 0 && special[vp] != 0) {
    special[vp] = c;
    special[up] = c;
    mc = c;
  } else {
    int max = special[up] > special[vp] ? special[up] : special[vp];
    special[up] = special[vp] = max;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<edge> edges;
  int special[n];
  for (int i = 0; i < n; i++) {
    special[i] = 0;
  }
  for (int i = 0; i < k; i++) {
    int tmp;
    cin >> tmp;
    tmp--;
    special[tmp] = 1;
  }
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    edges.push_back({u, v, w});
  }
  sort(edges.begin(), edges.end(), compare);
  int parent[n];
  for (int i = 0; i < n; i++) {
    parent[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int u = edges[i].u;
    int v = edges[i].v;
    int c = edges[i].c;
    uni(special, parent, u, v, c);
  }
  for (int i = 0; i < k; i++) {
    cout << mc << ' ';
  }
  return 0;
}
