#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int m; cin >> m; map<int,int> mp; for(int i = 0; i < m; i++){ int a, b, c; cin >> a >> b >> c; mp[a]++, mp[b]++, mp[c]++; } int v2 = (*mp.begin()).second; for(auto [key, v] : mp){ if(v != v2){ cout << "NO\n"; return 0; } } cout << "YES\n"; }