• + 1 comment

    int main() { int n,x,y,x1,y1,cx=0,cy=0,flag=0,num; scanf("%d",&n); num=n; while(n--) { if(flag==0) { scanf("%d%d",&x,&y); x1=x; y1=y; flag=1; } else if(flag==1) { scanf("%d%d",&x,&y); if(x==x1) { cx++; } else if(y==y1) { cy++; } } } if(cx==num-1 || cy==num-1) { printf("YES"); } else { printf("NO"); } }