#include <bits/stdc++.h>
using namespace std;
long long edgestory;
long long last;
struct UnionFind {
  vector<int> f;
  vector<bool> special;
  void init(int n) {
    f.clear();
    f.insert(f.begin(), n, -1);
    special.clear();
    special.insert(special.begin(), n, false);
    edgestory = 0;
  }
  int comp(int x) { return (f[x] == -1 ? x : f[x] = comp(f[x])); }
  bool sp(int x) { return special[comp(x)]; }
  bool join1(int i, int j) {
    if (i == j) return true;
    edgestory++;
    bool con = comp(i) == comp(j);
    if (!con) {
      bool spv = sp(i) || sp(j);
      if (sp(i) && sp(j)) last = edgestory;
      f[comp(i)] = comp(j);
      special[comp(i)] = spv;
    }
    return con;
  }
  pair<int, int> join2(int i, int j) {
    if (i == j) return {0, 0};
    edgestory++;
    if (edgestory == last) return {i, j};
    bool con = comp(i) == comp(j);
    if (!con) {
      f[comp(i)] = comp(j);
    }
    return {0, 0};
  }
} uf;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> special(k);
  for (auto &x : special) cin >> x;
  vector<tuple<long long, long long, long long>> edges(m);
  for (auto &x : edges) {
    long long u, v, w;
    cin >> u >> v >> w;
    x = make_tuple(w, u - 1, v - 1);
  }
  sort(edges.begin(), edges.end());
  uf.init(n);
  for (auto &x : special) uf.special[x - 1] = true;
  for (auto &[w, u, v] : edges) uf.join1(u, v);
  long long lastw = 0;
  uf.init(n);
  for (auto &[w, u, v] : edges) {
    lastw = w;
    if (uf.join2(u, v) != make_pair(0, 0)) break;
  }
  for (int i = 0; i < k; i++) cout << " " + !i << lastw;
  cout << endl;
  return 0;
}
