#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int m; cin >> m; vector<tuple<int,int,int>> a(m); vector<int> ca; for(auto &&[A, B, C] : a){ cin >> A >> B >> C; ca.emplace_back(A); ca.emplace_back(B); ca.emplace_back(C); } sort(ca.begin(), ca.end()); ca.erase(unique(ca.begin(), ca.end()), ca.end()); vector<int> cnt(ca.size()); for(auto &&[A, B, C] : a){ A = lower_bound(ca.begin(), ca.end(), A) - ca.begin(); B = lower_bound(ca.begin(), ca.end(), B) - ca.begin(); C = lower_bound(ca.begin(), ca.end(), C) - ca.begin(); cnt[A]++, cnt[B]++, cnt[C]++; } for(auto &&[A, B, C] : a){ if(cnt[A] != cnt[B] || cnt[A] != cnt[C]){ cout << "NO\n"; return 0; } } cout << "YES\n"; }