#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long N = 100100;
long long n, k, m;
vector<vector<long long> > edg;
long long special[N];
long long parent[N];
long long size[N];
void make_set(long long x) {
  parent[x] = x;
  size[x] = 1;
}
long long find_set(long long v) {
  if (v == parent[v]) {
    return v;
  }
  return parent[v] = find_set(parent[v]);
}
void union_sets(long long a, long long b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (size[a] < size[b]) {
      swap(a, b);
    }
    parent[b] = a;
    size[a] += size[b];
  }
}
map<long long, long long> cnt;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  for (long long i = 0; i < k; i++) {
    long long temp;
    cin >> temp;
    special[temp] = 1;
    cnt[temp] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    make_set(i);
  }
  for (long long i = 0; i < m; i++) {
    vector<long long> temp;
    temp.resize(3);
    cin >> temp[1] >> temp[2] >> temp[0];
    edg.push_back(temp);
  }
  sort(edg.begin(), edg.end());
  long long mx = -1;
  for (auto i : edg) {
    long long u, v, w;
    u = i[1], v = i[2], w = i[0];
    if (cnt[find_set(u)] > 0 and cnt[find_set(v)] > 0) {
      if (find_set(u) != find_set(v)) {
        mx = w;
        long long t1 = cnt[find_set(u)];
        long long t2 = cnt[find_set(v)];
        union_sets(find_set(u), find_set(v));
        long long s = find_set(u);
        cnt[s] = t1 + t2;
      }
    } else {
      long long t1 = cnt[find_set(u)];
      long long t2 = cnt[find_set(v)];
      union_sets(find_set(u), find_set(v));
      long long s = find_set(u);
      cnt[s] = t1 + t2;
    }
  }
  for (long long i = 0; i < k; i++) {
    cout << mx << " ";
  }
  cout << "\n";
  return 0;
}
