#include #include #include #include #include using namespace std; inline int in() { int noRead=0; char c=getchar_unlocked(); for(;c<33;){c=getchar_unlocked();}; while(c>32) { noRead = (noRead << 3) + (noRead << 1) + (c - '0'); c=getchar_unlocked(); } return noRead; }; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n=in(),x=in(),y=in(),x1=in(),y1=in(),k=x-x1,l=y-y1; if(k && l) { printf("NO"); return 0; } else if(k && !l) { for(;n>2;n--) { x1=in(); y1=in(); if((y-y1)) { printf("NO"); return 0; } } printf("YES"); return 0; } else if(!k && l) { for(;n>2;n--) { x1=in(); y1=in(); if((x-x1)) { printf("NO"); return 0; } } printf("YES"); return 0; } else { x1=in(); y1=in(); k=x-x1; l=y-y1; if(k && l) { printf("NO"); return 0; } else if(k && !l) { for(;n>3;n--) { x1=in(); y1=in(); if((y-y1)) { printf("NO"); return 0; } } printf("YES"); return 0; } else if(!k && l) { for(;n>3;n--) { x1=in(); y1=in(); if((x-x1)) { printf("NO"); return 0; } } printf("YES"); return 0; } } return 0; }