using System; using System.Globalization; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Threading; namespace Codeforces { class Program : ProgramBase { private const long commonMod = 1000000007; static void Main(string[] args) { var p = new Program(); var x = p.Get(); p.Out(x); } object Get() { checked { var n = ReadIntToken(); var points = new int[n][]; for (int i = 0; i < n; i++) { points[i] = ReadInts(); } var y = points[0][1]; var isEqY = true; for (int i = 1; i < n; i++) { isEqY &= points[i][1] == y; } var x = points[0][0]; var isEqX = true; for (int i = 1; i < n; i++) { isEqX &= points[i][0] == x; } return (isEqX || isEqY) ? "YES" : "NO"; } } public static class Struct { public static Pair Create(T1 item1, T2 item2) { return new Pair { Item1 = item1, Item2 = item2 }; } } public struct Pair { public T1 Item1 { get; set; } public T2 Item2 { get; set; } } class Automata { bool[] terminals; public int sigma; public int len; public int[,] jumps; public void Create() { var a = ReadInts(); len = a[0]; sigma = a[2]; var ts = ReadInts(); terminals = new bool[len]; for (int i = 0; i < ts.Length; i++) terminals[ts[i]] = true; jumps = new int[len, sigma]; for (int i = 0; i < len * sigma; i++) { var b = Console.ReadLine().Split(' '); jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]); } } protected int[] ReadInts() { return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray(); } public bool IsTerminal(int s) { return terminals[s]; } } } abstract class ProgramBase { bool? prod = null; StreamReader f; Queue tokens; protected string FileName { private get; set; } protected string Read() { if (f == null) f = string.IsNullOrEmpty(FileName) ? new StreamReader(Console.OpenStandardInput()) : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName); return f.ReadLine(); } protected int ReadInt() { return int.Parse(Read()); } protected int ReadIntToken() { if (tokens == null || tokens.Count == 0) tokens = new Queue(Read().Split(' ')); return int.Parse(tokens.Dequeue()); } protected int[] ReadInts() { var tokens = Read().Split(' '); var result = new int[tokens.Length]; for (int i = 0; i < tokens.Length; i++) result[i] = int.Parse(tokens[i]); return result; } protected long ReadLongToken() { if (tokens == null || tokens.Count == 0) tokens = new Queue(Read().Split(' ')); return long.Parse(tokens.Dequeue()); } protected long ReadLong() { return Convert.ToInt64(Read()); } protected long[] ReadLongs() { var tokens = Read().Split(' '); var result = new long[tokens.Length]; for (int i = 0; i < tokens.Length; i++) result[i] = long.Parse(tokens[i]); return result; } public void Out(object r) { if (string.IsNullOrEmpty(FileName)) Console.WriteLine(r); else if (GetProd()) File.WriteAllText(FileName, r.ToString()); else Console.WriteLine(r); } private bool GetProd() { if (!prod.HasValue) try { prod = Environment.MachineName != "RENADEEN-W7"; } catch (Exception) { prod = true; } return prod.Value; } } public static class Huj { public static T MinBy(this IEnumerable source, Func func) where T : class { T result = null; var min = double.MaxValue; foreach (var item in source) { var current = func(item); if (min > current) { min = current; result = item; } } return result; } public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T)) { T result = defaultValue; var max = double.MinValue; foreach (var item in source) { var current = func(item); if (max < current) { max = current; result = item; } } return result; } public static string JoinStrings(this IEnumerable source, string delimeter) { return string.Join(delimeter, source.ToArray()); } public static string JoinStrings(this IEnumerable source, string delimeter) { return source.Select(x => x.ToString()).JoinStrings(delimeter); } } }