#include <bits/stdc++.h>
using namespace std;
long long nMod = 1e9 + 7;
inline long long GCD(long long a, long long b) {
  while (b != 0) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
};
inline long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; };
int n, m, k;
int cnt[100005];
int root[100005];
vector<pair<int, pair<int, int> > > arr;
int getRoot(int u) {
  if (root[u] == 0) return u;
  return root[u] = getRoot(root[u]);
}
void unionRoot(int u, int v) {
  if (getRoot(u) == getRoot(v)) return;
  cnt[getRoot(v)] += cnt[getRoot(u)];
  root[getRoot(u)] = getRoot(v);
}
void input() {
  cin >> n >> m >> k;
  int P;
  for (int i = 0; i < k; i++) {
    int u;
    cin >> u;
    cnt[u] = 1;
    P = u;
  }
  for (int i = 0; i < m; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    arr.push_back({c, {u, v}});
  }
  sort(arr.begin(), arr.end());
  int res = 0;
  for (auto x : arr) {
    int c = x.first;
    int u = x.second.first;
    int v = x.second.second;
    unionRoot(u, v);
    if (cnt[getRoot(u)] == k) {
      res = c;
      break;
    }
  }
  for (int i = 0; i < k; i++) {
    cout << res << " ";
  }
  cout << "\n";
}
void vietnakid() { input(); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  vietnakid();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
