#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector S(N), T(N); for (int i = 0; i < N; i++) cin >> S[i] >> T[i]; string ans = "Yes"; for (int i = 0; i < N; i++) { bool okS = true, okT = true; for (int j = 0; j < N; j++) { if (i == j) continue; okS = okS && (S[i] != S[j]) && (S[i] != T[j]); okT = okT && (T[i] != S[j]) && (T[i] != T[j]); } if (!okS && !okT) ans = "No"; } cout << ans << endl; }