#include #include #include #include #include #include #include #include "testlib.h" using namespace std; using namespace atcoder; int main(int argc, char* argv[]) { registerValidation(argc, argv); int n = inf.readInt(2, 100, "n"); inf.readEoln(); int m = n * (n - 1) / 2; vector a(m); vector b(m); vector c(m); for (int i = 0; i < m; i++) { a[i] = inf.readInt(1, n, "a_i") - 1; inf.readSpace(); b[i] = inf.readInt(1, n, "b_i") - 1; inf.readSpace(); c[i] = inf.readToken("[0-9]{1,101}", "c_i"); inf.readEoln(); } inf.readEof(); dsu uf(n); for(int i=0;i