#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 4;
const int M = 1e9 + 7;
vector<pair<int, int> > g[N];
const int inf = 1e9 + 10;
vector<int> dist(N, inf);
void dijkstra(int source) {
  dist[source] = 0;
  set<pair<int, int> > s;
  s.insert({0, source});
  while (!s.empty()) {
    auto x = *(s.begin());
    s.erase(x);
    for (auto it : g[x.second])
      if (dist[it.first] > max(dist[x.second], it.second)) {
        s.erase({dist[it.first], it.first});
        dist[it.first] = max(dist[x.second], it.second);
        s.insert({dist[it.first], it.first});
      }
  }
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  int x[k];
  for (int i = 0; i < k; i++) cin >> x[i];
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    if (u != v) {
      g[u].push_back({v, w});
      g[v].push_back({u, w});
    }
  }
  dijkstra(x[0]);
  int ans = 0;
  for (int i = 0; i < k; i++) ans = max(ans, dist[x[i]]);
  for (int i = 0; i < k; i++) cout << ans << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
