using System; using System.Collections.Generic; using System.Linq; public class Program{ public static void Main(){ var line = Console.ReadLine().Split(' '); var h = int.Parse(line[0]); var w = int.Parse(line[1]); var s = new string[h]; var a = new List(); int i,j,l,e; for(i=0;i>(); for(i=0;i(); for(j=0;j value!=j)){ k.Add(a[j]); } } B.Add(k); } bool c = a.Count%2==0; if(!c){ Console.WriteLine("NO"); } i=0; while(c&&i(); foreach(var x in A[i]){ var k = new int[2]; k[0] = a[x][0] + j; k[1] = a[x][1] + l; m.Add(k); } var z = new bool[m.Count]; for(e=0;evalue)){ c = false; Console.WriteLine("YES"); break; } } } i++; } if(c){ Console.WriteLine("NO"); } } static class Combination { private static List> _comb; public static List> Generate(int n, int r, bool dupulication) { _comb = new List>(); CalcCombination(new List(), n, r, dupulication); return _comb; } private static void CalcCombination(List list, int n, int r, bool dupulication) { if (list.Count == r) { _comb.Add(new List(list)); return; } var index = 0; if (dupulication) { index = list.Any() ? list.Last() : 0; } else { index = list.Any() ? list.Last() + 1 : 0; } for (int i = index; i < n; i++) { list.Add(i); CalcCombination(list, n, r, dupulication); list.Remove(i); } } } }