import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); int n= t; Map m = new HashMap(); Map m1 = new HashMap(); while(t-->0){ int a = s.nextInt(); int b = s.nextInt(); if(m.containsKey(a)) m.put(a, m.get(a)+1); else m.put(a, 1); if(m1.containsKey(b)) m1.put(b, m1.get(b)+1); else m1.put(b, 1); } for(Entry e : m.entrySet()) { if(e.getValue().equals(n)){ System.out.println("YES"); return; } } for(Entry e : m1.entrySet()) { if(e.getValue().equals(n)){ System.out.println("YES"); return; } } System.out.println("NO"); } }