import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class PointsOnALine { public static void main(String[] args) throws IOException { BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(reader.readLine()); ArrayList x=new ArrayList<>(), y=new ArrayList<>(); while(n-- >0){ StringTokenizer str=new StringTokenizer(reader.readLine()); int x1=Integer.parseInt(str.nextToken()); int y1=Integer.parseInt(str.nextToken()); if(!x.contains(x1)){ x.add(x1); } if(!y.contains(y1)){ y.add(y1); } } if(x.size()==1 || y.size()==1){ System.out.println("YES"); } else{ System.out.println("NO"); } } }