#include using namespace std; #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define lfs <= (ll)(m); i--) typedef long long ll; typedef long double ld; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>v,ll h,ll w){for(ll i=0;iv,ll h,ll w){for(ll i=0;i void debug(vectorv,ll n){cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} template void emp(map&m, T x){m.emplace(x,0).first->second++;} ll MAX_V = 2e5 + 5; struct edge { ll to,cost; edge(ll x,ll y):to(x),cost(y){}; }; vector> G(MAX_V); vectort(MAX_V); ll ret=0; ll n; ll dfs(ll k){ t[k]=1; ll num=1; for(ll i=0;i>n; for(ll i=0;i>u>>v>>c; G[u].emplace_back(v,c); G[v].emplace_back(u,c); } dfs(1); cout<