#include <bits/stdc++.h>
using namespace std;
const long long MaxN = 1 + 1e5;
long long n, a[MaxN], m, k, x, t, y, z, root[MaxN], nt, query, vis[MaxN], ma,
    f[MaxN], d[MaxN];
vector<pair<long long, long long> > q[MaxN];
template <typename T>
void read(T& t) {
  t = 0;
  char ch = getchar();
  int f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  do {
    (t *= 10) += ch - '0';
    ch = getchar();
  } while (isdigit(ch));
  t *= f;
}
struct Edge {
  long long u, v, len;
  Edge(long long _u = 0, long long _v = 0, long long _len = 0)
      : u(_u), v(_v), len(_len) {}
  bool operator<(const Edge& op) const { return len < op.len; }
} e[MaxN];
long long getRoot(long long u) {
  if (u == root[u]) return u;
  return root[u] = getRoot(root[u]);
}
void DFS(long long u) {
  vis[u] = 1;
  for (auto i : q[u])
    if (!vis[i.first]) {
      f[i.first] = max(f[u], i.second);
      if (d[i.first]) ma = max(ma, f[i.first]);
      DFS(i.first);
    }
}
void InOut() {
  freopen(
      "ABC"
      ".inp",
      "r", stdin);
  freopen(
      "ABC"
      ".out",
      "w", stdout);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read(n);
  read(m);
  read(t);
  for (int i = 0; i < t; ++i) {
    read(x);
    x--;
    d[x] = 1;
    query = x;
  }
  for (int i = 0; i < m; ++i) {
    read(x);
    read(y);
    read(z);
    x--;
    y--;
    e[i] = Edge(x, y, z);
  }
  sort(e, e + m);
  for (int i = 0; i < n; ++i) root[i] = i;
  for (int i = 0; i < m; ++i) {
    long long u = e[i].u, v = e[i].v, len = e[i].len;
    long long ru = getRoot(u), rv = getRoot(v);
    if (ru == rv) continue;
    root[ru] = rv;
    q[u].push_back({v, len});
    q[v].push_back({u, len});
  }
  DFS(query);
  for (int i = 0; i < t; ++i) cout << ma << " ";
  return 0;
}
