#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, m, k, X[maxn], sp[maxn], par[maxn], mx[maxn];
vector<pair<int, pair<long long, long long> > > edges;
int root(int v) { return v == par[v] ? v : par[v] = root(par[v]); }
void unite(int a, int b, int w) {
  if ((a = root(a)) == (b = root(b))) return;
  if (sp[a] && sp[b]) mx[a] = w;
  mx[a] = max(mx[a], mx[b]);
  par[b] = a;
  sp[a] |= sp[b];
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) {
    int a;
    cin >> a;
    X[i] = a;
    sp[a] = 1;
  }
  for (int i = 1; i <= n; i++) par[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b, w;
    cin >> a >> b >> w;
    edges.push_back({w, {a, b}});
  }
  sort(edges.begin(), edges.end());
  for (auto edge : edges)
    unite(edge.second.first, edge.second.second, edge.first);
  for (int i = 1; i <= k; i++) cout << mx[root(i)] << " ";
  return 0;
}
