import java.io.PrintWriter import java.lang.Exception import java.util.* fun PrintWriter.solve() { val n = nextInt() val m = n * (n - 1) / 2 if (n !in 2..100) { throw Exception("2<=n<=100") } val a = Array(m) { 0 } val b = Array(m) { 0 } val c = Array(m) { 0.toBigInteger() } for (i in 0 until m) { val x = nextInt() val y = nextInt() if (x !in 1..n) { throw Exception("1<=a[i]<=n") } if (y !in 1..n) { throw Exception("1<=b[i]<=n") } val z = next() a[i] = x - 1 b[i] = y - 1 c[i] = z.toBigInteger() if (c[i] !in 1.toBigInteger().."10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".toBigInteger() ) { throw Exception("1<=c[i]<=10^100") } if (a[i] == b[i]) { throw Exception("a[i]!=b[i]") } } for (i in 1 until m) { if (c[i - 1] >= c[i]) { throw Exception("c[i-1]