#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e14 + 9;
vector<pair<long long, long long> > adj[200009];
long long n, m;
long long dis[200009];
void addedge(long long a, long long b, long long c) {
  adj[a].push_back({b, c});
  adj[b].push_back({a, c});
}
void INFINITAR() {
  for (long long i = 0; i <= n; i++) {
    dis[i] = INF;
  }
}
void dijkstra(int x) {
  INFINITAR();
  dis[x] = 0;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  pq.push({0, x});
  while (!pq.empty()) {
    auto f = pq.top();
    pq.pop();
    if (dis[f.second] < f.first) continue;
    for (auto e : adj[f.second]) {
      if (max(f.first, e.second) < dis[e.first]) {
        dis[e.first] = max(f.first, e.second);
        pq.push({dis[e.first], e.first});
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long k;
  cin >> n >> m >> k;
  int sp[200009];
  memset(sp, 0, sizeof sp);
  long long spini = -1;
  for (long long i = 0; i < (k); ++i) {
    long long a;
    cin >> a;
    a--;
    spini = a;
    sp[a] = 1;
  }
  while (m--) {
    long long a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    adj[a].push_back({b, c});
    adj[b].push_back({a, c});
  }
  long long ans = 0;
  dijkstra(spini);
  for (long long i = 0; i < (n); ++i) {
    if (sp[i] == 1) ans = max(ans, dis[i]);
  }
  for (long long i = 0; i < (k); ++i) {
    cout << ans << " ";
  }
  cout << "\n";
  return 0;
}
