#include using namespace std; #include using namespace atcoder; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair #define LP pair #define fi first #define se second #define pb push_back #define eb emplace_back #define all(s) s.begin(), s.end() #define rall(s) s.rbegin(), s.rend() template void chmax(T& a, T b) { a = max(a, b); }; template void chmin(T& a, T b) { a = min(a, b); }; int main() { int n; cin >> n; int m = n*(n-1)/2; dsu uf(m+1); rep(i,m) { int a, b; string c; cin >> a >> b >> c; a--, b--; if (uf.same(a,b)) continue; uf.merge(a,b); if (uf.size(a) == n) { cout << c << endl; return 0; } } return 0; }