#!/usr/bin/perl use Data::Dumper; $n = <>; chomp $n; @coord = (); for $i (0..$n-1) { $coord[$i] = [ split " ",<> ]; } #print Dumper(@coord); $x = $coord[0][0]; $y = $coord[0][1]; $ch1 = 0; $ch2 = 0; for $i (1..$n-1) { $ch1 = 1 if (!($x == $coord[$i][0])); $ch2 = 1 if (!($y == $coord[$i][1])); } if ($ch1 == 1 && $ch2 == 1) { print "NO\n"; } else { print "YES\n"; }