Lukman loves to search the root of everything.Once he was reading the holy Quran. At the beginning he found an attached article.It discusses that, "In Quran the word Insan (Man) comes 65 times, and the elements by which man is created; Turab (dust) comes 17 times, Nutfa (sperm-drop) comes 12 times, Alak (clinging clot) comes 6 times, Mudga (lump of flesh) comes 3 times, Ejam (bone) comes 15 times, Laham (flesh) comes12 times. By adding this values (17+12+6+3+15+12) it is found miraculously to be 65, the times the word Insan (Man) is mentioned."
This is not your task. Your task is to search similar types of miracle on an n*n grid, evaluating the rows, columns and diagonals.
The first input line contains an integer n (3 ≤ n ≤ 12) i.e the size of the grid.The next lines contain the cells filled with distinct positive integers in the range 1, 2, ..., n^2. Input will be terminate by EOF.
If you find it in the given orientation of the values on the grid Print YES, otherwise Print NO.
3 8 1 6 3 5 7 4 9 2 3 8 5 6 3 1 7 4 9 2