#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long pow(long long B, long long P) {
  long long S = 1;
  for (long long i = 1; i <= P; i++) S = S * B;
  return S;
}
long long fx4[] = {1, -1, 0, 0};
long long fy4[] = {0, 0, 1, -1};
struct edge {
  int V, W;
  edge(int a, int b) {
    V = a;
    W = b;
  }
};
struct node {
  int At, Cost;
  node(int a, int b) {
    At = a;
    Cost = b;
  }
};
bool operator<(node a, node b) { return a.Cost > b.Cost; }
vector<edge> G[400005];
priority_queue<node> PQ;
long long Dist[400005], Dist1[400005];
void Dijkstra(int S, int N) {
  for (int i = 1; i <= N; i++) Dist[i] = INT_MAX;
  Dist[S] = 0;
  PQ.push(node(S, 0));
  while (!PQ.empty()) {
    node U = PQ.top();
    PQ.pop();
    if (U.Cost != Dist[U.At]) continue;
    for (int i = 0; i < G[U.At].size(); i++) {
      edge V = G[U.At][i];
      if (max(Dist[U.At], V.W) < Dist[V.V]) {
        long long X = max(Dist[U.At], V.W);
        Dist[V.V] = min(Dist[V.V], X);
        PQ.push(node(V.V, Dist[V.V]));
      }
    }
  }
}
long long SP[400005];
int main() {
  long long T, N, M, K, X, Y, W;
  cin >> N >> M >> K;
  for (int i = 1; i <= K; i++) cin >> SP[i];
  for (int i = 1; i <= M; i++) {
    cin >> X >> Y >> W;
    G[X].push_back(edge(Y, W));
    G[Y].push_back(edge(X, W));
  }
  Dijkstra(SP[1], N);
  long long MAX = 0, S = SP[1];
  for (int i = 1; i <= K; i++) {
    X = Dist[SP[i]];
    if (X > MAX) {
      MAX = X;
      S = SP[i];
    }
  }
  for (int i = 1; i <= N; i++) Dist1[i] = Dist[i];
  Dijkstra(S, N);
  for (int i = 1; i <= K; i++) {
    long long ans = max(Dist[SP[i]], Dist1[SP[i]]);
    cout << ans << " ";
  }
  return 0;
}
