#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, u, v, w, X, Y, fa[100005], x[100005], ans[100005];
struct edge {
  int u, v, w;
  edge(int u = 0, int v = 0, int w = 0) : u(u), v(v), w(w) {}
} E[100005];
bool cmp(edge a, edge b) { return a.w < b.w; }
struct N {
  int v, w;
  N(int v = 0, int w = 0) : v(v), w(w) {}
};
vector<N> g[100005];
void dfs(int u, int f, int tp) {
  ans[u] = tp;
  for (int i = 0; i < g[u].size(); i++) {
    N e = g[u][i];
    if (e.v == f) continue;
    dfs(e.v, u, max(tp, e.w));
  }
}
int fin(int u) { return fa[u] == u ? u : fa[u] = fin(fa[u]); }
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) fa[i] = i;
  for (i = 1; i <= k; i++) scanf("%d", &x[i]);
  for (i = 0; i < m; i++) {
    scanf("%d%d%d", &E[i].u, &E[i].v, &E[i].w);
  }
  sort(E, E + m, cmp);
  for (i = 0; i < m; i++) {
    u = E[i].u;
    v = E[i].v;
    w = E[i].w;
    X = fin(u);
    Y = fin(v);
    if (X != Y) {
      fa[X] = Y;
      g[u].push_back(N(v, w));
      g[v].push_back(N(u, w));
    }
  }
  dfs(x[1], 0, 0);
  for (i = 2; i <= k; i++) ans[x[i]] = max(ans[x[i - 1]], ans[x[i]]);
  for (i = 1; i <= k; i++) printf("%d ", ans[x[k]]);
}
