structEdge { int a, b, c; }; vector<Edge> edges; vector<int> adj[maxn];
structState { int u; ll d; booloperator < ( const State &oth ) const { return d > oth.d; } };
bool vis[maxn]; ll f[maxn]; ll dp[maxn];
voidsolve( ){ int n = read( );
priority_queue<State> pq; for( int i = 0; i < n; ++ i ) { f[i] = read( ); dp[i] = 1; pq.push({ i, f[i] }); }
int a, b, c; while( cin >> a >> b >> c ) { int id = edges.size( ); edges.push_back({ a, b, c }); adj[a].push_back( id ); if( a == b ) continue; adj[b].push_back( id ); }