#include #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main(){ int n; cin >> n; vector s(n), t(n); rep(i, n) cin >> s[i] >> t[i]; rep(i, n) { bool found = false; for (string x : {s[i], t[i]}) { bool ok = true; rep(j, n) if (j != i) { ok &= x != s[j] and x != t[j]; } if (ok) found = true; } if (not found) { puts("No"); return 0; } } puts("Yes"); return 0; }