using System; using System.Linq; namespace y { class Program { static void Main(string[] args) { string[] ss = Console.ReadLine().Split(); int n = int.Parse(ss[0]); int m = int.Parse(ss[1]); int[] a = new int[n]; for (int i = 0; i < m; i++) { int[] b = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < n; j++) { a[j] += b[j]; } for (int j = 0; j < n; j++) { if (a[j] == 777) { Console.WriteLine("YES"); return; } if (j != n - 1 && a[j] + a[j + 1] == 777) { Console.WriteLine("YES"); return; } } Console.WriteLine("NO"); } } } }