Олимпиадный тренинг

Задача 43134. Negotiation ambush


Задача

Темы:
Sasha Bely and his team came to Satka for negotiations. However, the conversation promises to be hot, so Sasha wants to hide his lads in an ambush. Negotiations will take place on a square field of size 2N × 2N, and White can put from 0 to 2 bros in each cell of this field. Since Sasha does not like to repeat himself, the total number of bros in each column and in each row of the square field should be different.
As you know, due to certain circumstances, Bely did not graduate from the university, so he is not good at programming, and you need to urgently help him.
Tell Bely whether he can arrange the lads with the given condition, and if so, give an example of the arrangement.
Input
The input contains a single integer N such that 2N — margin side length (1 <= N <= 300).
Imprint
On the first line print YES if there is an arrangement such that the total number of brothers in each column and in each row of the square field is different, and NO otherwise. If the arrangement exists, then print an example on the next 2N lines. If there are several suitable arrangements, you can print any of them.
 
Examples
# Input Output
1 1 YES
0 0
1 2
2 2 YES
0 1 0 2
2 2 0 2
0 2 1 2
0 2 0 2