#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector s(n), t(n); for (int i = 0; i < n; i++) { cin >> s[i] >> t[i]; } for (int i = 0; i < n; i++) { bool s_ok = true, t_ok = true; for (int j = 0; j < n; j++) { if (i == j) continue; if (s[i] == s[j] || s[i] == t[j]) s_ok = false; if (t[i] == t[j] || t[i] == s[j]) t_ok = false; if (!s_ok && !t_ok) { cout << "No" << endl; return 0; } } } cout << "Yes" << endl; }