#include <bits/stdc++.h>
using namespace std;
const int size = 1e5 + 9;
vector<pair<int, pair<int, int>>> con;
vector<int> spec;
int tab[size];
int find(int x) {
  if (tab[x] != x) tab[x] = find(tab[x]);
  return tab[x];
}
bool join(int x, int y) {
  int first = find(x);
  int second = find(y);
  if (first == y) return false;
  tab[first] = second;
  return true;
}
int n, m, k;
void init() {
  for (int i = 0; i < size; i++) tab[i] = i;
  cin >> n;
  cin >> m;
  cin >> k;
  spec.resize(k);
  for (int i = 0; i < k; i++) cin >> spec[i];
  con.resize(m);
  for (int i = 0; i < m; i++)
    cin >> con[i].second.first >> con[i].second.second >> con[i].first;
}
void prepare() { sort(con.begin(), con.end()); }
bool isOk(int h) {
  for (int i = 0; i < size; i++) tab[i] = i;
  for (int i = 0; i <= h; i++) join(con[i].second.first, con[i].second.second);
  int last = find(spec[0]);
  for (int i = 1; i < k; i++)
    if (last != find(spec[i])) return false;
  return true;
}
void solve() {
  int s = 0;
  int e = m - 1;
  int b = -1;
  while (s <= e) {
    int m = (s + e) / 2;
    if (isOk(m)) {
      b = m;
      e = m - 1;
    } else
      s = m + 1;
  }
  for (int i = 0; i < k; i++) cout << con[b].first << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  init();
  prepare();
  solve();
  return 0;
}
