#include using namespace std; int n, a, b; string c, w; int p[101], r[101]; int find(int x) { if (p[x] == x) return x; return p[x] = find(p[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (r[x] < r[y]) p[x] = y; else { p[y] = x; if (r[x] == r[y]) r[x]++; } } bool same(int x, int y) { return find(x) == find(y); } bool ck() { for (int i = 1; i < n; i++) { if (!same(i, i + 1)) return false; } return true; } int main() { cin >> n; for (int i = 1; i <= n; i++) p[i] = i; for (int i = 0; i < n * (n - 1) / 2; i++) { cin >> a >> b >> c; unite(a, b); if (i > n - 3 && w == "" && ck()) w = c; } cout << w << endl; }