#include #include #include using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) struct UnionFind{ vector par; UnionFind(int n){ par.resize(n); rep(i, n) par[i]=i; } int find(int i){ return par[i]==i ? par[i] : (par[i]=find(par[i])); } void unite(int i, int j){ par[find(i)]=find(j); } bool same(int i, int j){ return find(i)==find(j); } }; using i64=long long; struct Edge{ int u, v; i64 cost; Edge(int u, int v, i64 c):u(u), v(v), cost(c){}; }; int main(){ int n, m, k; cin>> n>> m>> k; vector edges; rep(_, m){ int a, b; i64 c; cin>> a>> b>> c; edges.push_back(Edge{a-1, b-1, c}); } int mask=0; rep(_, k){ int i; cin>> i; i--; mask^=(1<