#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int A[16][16]={
	{1,2,3,4,3,2,1,2,3,4,3,2,1,2,3,4},
	{4,3,2,1,2,3,4,3,2,1,2,3,4,3,2,1},
	{2,1,4,3,4,1,2,1,4,3,4,1,2,1,4,3},
	{3,4,1,2,1,4,3,4,1,2,1,4,3,4,1,2},
	{1,2,3,4,3,2,1,2,3,4,3,2,1,2,3,4},
	{4,3,2,1,2,3,4,3,2,1,2,3,4,3,2,1},
	{2,1,4,3,4,1,2,1,4,3,4,1,2,1,4,3},
	{3,4,1,2,1,4,3,4,1,2,1,4,3,4,1,2},
	{1,2,3,4,3,2,1,2,3,4,3,2,1,2,3,4},
	{4,3,2,1,2,3,4,3,2,1,2,3,4,3,2,1},
	{2,1,4,3,4,1,2,1,4,3,4,1,2,1,4,3},
	{3,4,1,2,1,4,3,4,1,2,1,4,3,4,1,2},
	{1,2,3,4,3,2,1,2,3,4,3,2,1,2,3,4},
	{4,3,2,1,2,3,4,3,2,1,2,3,4,3,2,1},
	{2,1,4,3,4,1,2,1,4,3,4,1,2,1,4,3},
	{3,4,1,2,1,4,3,4,1,2,1,4,3,4,1,2}
};

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	for(int i = 0;i<16;i++)
		for(int j = 0;j<16;j++) cout << A[i][j] << "\n "[j<15];
}