Chef has a rectangular matrix A of nxm integers. Rows are numbered by integers from 1 to n from top to bottom, columns - from 1 to m from left to right. Ai, j denotes the j-th integer of the i-th row.
Chef wants you to guess his matrix. To guess integers, you can ask Chef questions of next type: "How many integers from submatrix iL, iR, jL, jR are grater than or equal to x and less than or equal to y?". By submatrix iL, iR, jL, jR we mean all elements Ai, j for all iL ≤ i ≤ iR and jL ≤ j ≤ jR. 
Also Chef can answer not more than C questions of next type: "What is the sum of integers from submatrix iL, iR, jL, jR?"
As soon as you think you know the Chefs matrix, you can stop asking questions and tell to the Chef your variant of the matrix. Please see "Scoring" part to understand how your solution will be evaluated. 

-----Input-----
The first line of the input contains three space-separated integers n, m and C denoting the sizes of the matrix and the maximum number of the second-type questions. After that the judge will answer your questions and evaluate the resuts. Read more about that in the "Interaction with the judge" part of the statement. 

-----Interaction with the judge-----
To ask a first-type question you should print to the standard output one line containing seven space-separated integers 1 iL iR jL jR x y. To ask a second-type question you should print one line containing five space-separated integers 2 iL iR jL jR. After that you should read from the standard input one integer - answer to the question. To end the game you should print 3 and starting from next line print n lines, each of them contains m space-separated integers - your variant of the matrix A. After that your program must stop. Remember to flush the output after every line you print.

-----Constraints-----
- 1 ≤ n, m ≤ 2.5 * 105
- 1 ≤ n * m ≤ 2.5 * 105
- 103 ≤ C ≤ 104
- 1 ≤ Ai, j ≤ 50
- 1 ≤ iL ≤ iR ≤ n
- 1 ≤ jL ≤ jR ≤ m
- 1 ≤ x ≤ y ≤ 50
- 0 ≤ number of asked questions ≤ 5 * 105
- 1 ≤ Bi, j ≤ 50
- 1 ≤ a1, a2, a3 ≤ 10

----- Scoring -----
Let B will be the matrix you output and diff = ∑ |Ai, j - Bi, j| for all 1 ≤ i ≤ n, 1 ≤ j ≤ m. The number of questions you asked is questions. The number of integers, you correctly guessed is correct(i. e. the number of elements i, j such that Ai, j = Bi, j). 
The score for each test case will be: score = a1 * questions +  a2 * diff +  a3 * (n * m - correct).
Your goal is to minimize this score.
Your total score for the problem will be the sum of scores on all the test cases.

-----Example-----
Input:
3 3 10
4
0
3
1
6

Output:
1 1 2 1 2 1 3
1 3 3 1 3 1 1
1 3 3 1 3 2 2
1 1 2 3 3 1 1
2 3 3 1 3
3
2 2 1
2 2 1
2 2 2


-----Explanation-----

[1, 2, 3]
A = [3, 2, 1]
[2, 2, 2]

For this test case a1 = 1, a2 = 1 and a3 = 1.
The score for this test case will be 1 * 5 + 1 * 4 + 1 * (9 - 6) = 12.

----- Test data generation -----
There will be four types of the test files.
- Type #1: n = 10,  m = 25000
- Type #2: n = 100,  m = 2500
- Type #3: n = 250,  m = 1000
- Type #4: n = 500,  m = 500
There will be 5 test files of each type. During the contest, you will be shown the score for only one test file of each type.
All elements of matrix A are randomly chosen.
For each test case C is randomly chosen from interval [103 .. 104].
For each test case values a1, a2 and a3 are manually chosen. 

Starter code:

Solutions:
# CHNGSS.py

import sys
from random import *

n,m,c = list(map(int,input().split()))
arr = [[1]*m for i in range(n)];
saved = 0;
for i in range(n):
	for j in range(m):
		print(1,(i+1),(i+1),(j+1),(j+1),1,25)
		sys.stdout.flush()
		a = int(input())
		if a == 1 :
			saved += 1;
			arr[i][j] = randint(1,25);
		else:
			arr[i][j] = randint(25,50);
print(3);
sys.stdout.flush()
for a in arr :
	print(' '.join(map(str,a)));
	sys.stdout.flush()
# sys.exit(0);

# CHNGSS.py

import sys
from random import *

n,m,c = list(map(int,input().split()))
arr = [[1]*m for i in range(n)];
saved = 0;
for i in range(n):
	for j in range(m):
		print(1,(i+1),(i+1),(j+1),(j+1),1,15)
		sys.stdout.flush()
		a = int(input())
		if a == 1 :
			saved += 1;
			arr[i][j] = randint(1,15);
		else:
			print(1,(i+1),(i+1),(j+1),(j+1),16,30)
			sys.stdout.flush()
			a = int(input())
			if a == 1 :
				arr[i][j] = randint(16,30);
			else:
				if saved > 0 :
					saved -= 1;
					print(1,(i+1),(i+1),(j+1),(j+1),31,40);
					sys.stdout.flush()
					a = int(input())
					if a == 1 :
						arr[i][j] = randint(31,40);
					else:
						arr[i][j] = randint(41,50);
				else:
					arr[i][j] = randint(31,50);
print(3);
sys.stdout.flush()
for a in arr :
	print(' '.join(map(str,a)));
	sys.stdout.flush()
# sys.exit(0);

# CHNGSS_1.py

from random import *

n,m,c = list(map(int,input().split()))
print(3);
arr = [[0]*m for i in range(n)];
for i in range(n):
	for j in range(m):
		arr[i][j] = randint(1,50);

for a in arr :
	print(' '.join(map(str,a)));

import sys
##from random import randint
n,m,c = [int(i) for i in input().split()]
matrix = [[0]*(m+1) for i in range(n+1)]
cc = 1
nn= 1
mm = 1
'''
for nn in xrange(1,n+1) :
    for mm in xrange(1,m+1) :
        if cc <= c :
            print "2",
            print nn,nn,mm,mm
            sys.stdout.flush()
            matrix[nn][mm] = int(raw_input())
            cc += 1
        else :
            break
    if cc > c :
        break
###print matrix'''

for nnn in range(nn,n+1) :
    for mmm in range(mm,m+1) :
        
        x = 1
        y = 25
        z = 51
        while matrix[nnn][mmm] == 0 :
            if cc < 499990 :
                if abs(x-y) == 1 :
                    print("1", end=' ')
                    print(nnn,nnn,mmm,mmm,x,x)
                    sys.stdout.flush()
                    cc += 1
                    value = int(input())
                    if value == 1 :
                        matrix[nnn][mmm] = x
                    else :
                        matrix[nnn][mmm] = y
                    break
                else :
                    print("1", end=' ')
                    print(nnn,nnn,mmm,mmm,x,y)
                    sys.stdout.flush()
                    cc += 1
                    value = int(input())
                    if value == 1 :
                        z = y
                        y = (x+y)/2
                    else :
                        x = y
                        y = (y+z)/2 
              
            else :
                break
        
        
    if cc >= 499980 :
        break
print("3")
sys.stdout.flush()
for nn in range(1,n+1) :
    for mm in range(1,m+1) :
        if matrix[nn][mm] < 1 or matrix[nn][mm] > 50 :
            print("25", end=' ')
        else :
            print(matrix[nn][mm], end=' ')
    sys.stdout.flush()
    print()

import sys
##from random import randint
n,m,c = [int(i) for i in input().split()]
matrix = [[0]*(m+1) for i in range(n+1)]
cc = 1
nn= 1
mm = 1
for nn in range(1,n+1) :
    for mm in range(1,m+1) :
        if cc <= c :
            print("2", end=' ')
            print(nn,nn,mm,mm)
            sys.stdout.flush()
            matrix[nn][mm] = int(input())
            cc += 1
        else :
            break
    if cc > c :
        break
###print matrix

for nnn in range(nn,n+1) :
    for mmm in range(mm,m+1) :
        if c < 499990 :
            x = 1
            y = 25
            z = 51
            while matrix[nnn][mmm] == 0 :
                if abs(x-y) == 1 :
                    print("1", end=' ')
                    print(nnn,nnn,mmm,mmm,x,x)
                    sys.stdout.flush()
                    c += 1
                    value = int(input())
                    if value == 1 :
                        matrix[nnn][mmm] = x
                    else :
                        matrix[nnn][mmm] = y
                    break
                else :
                    print("1", end=' ')
                    print(nnn,nnn,mmm,mmm,x,y)
                    sys.stdout.flush()
                    c += 1
                    value = int(input())
                    if value == 1 :
                        z = y
                        y = (x+y)/2
                    else :
                        x = y
                        y = (y+z)/2 
              
        else :
            break
        
        
    if c >= 499980 :
        break
print("3")
sys.stdout.flush()
for nn in range(1,n+1) :
    for mm in range(1,m+1) :
        if matrix[nn][mm] < 1 or matrix[nn][mm] > 50 :
            print("25", end=' ')
        else :
            print(matrix[nn][mm], end=' ')
    sys.stdout.flush()
    print()

import sys
##from random import randint
n,m,c = [int(i) for i in input().split()]
matrix = [[0]*(m+1) for i in range(n+1)]
cc = 1
nn= 1
mm = 1
for nn in range(1,n+1) :
    for mm in range(1,m+1) :
        if cc <= c :
            print("2", end=' ')
            print(nn,nn,mm,mm)
            sys.stdout.flush()
            matrix[nn][mm] = int(input())
            cc += 1
        else :
            break
    if cc > c :
        break  
print("3")
sys.stdout.flush()
for nn in range(1,n+1) :
    for mm in range(1,m+1) :
        if matrix[nn][mm] < 1 or matrix[nn][mm] > 50 :
            print("25", end=' ')
        else :
            print(matrix[nn][mm], end=' ')
    print()

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		while(True):
			l = random.randint(1,50)
			h = random.randint(1,50)
			if (l<h):
				break
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,25)
		h = random.randint(25,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,11)
		h = random.randint(11,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,7)
		h = random.randint(7,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,5)
		h = random.randint(6,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,20)
		h = random.randint(21,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,10)
		h = random.randint(11,50)
		print(random.randint(l,h), end=' ')
	print("")

import sys,random
n,m,c=list(map(int,input().split()))
print(2,1,n,1,m)
sys.stdout.flush()
sum=int(input())
sum/=(n*m)
print(3)
sys.stdout.flush()
if sum-5<1:
       l=0
       r=sum+5
else:
       l=sum-5
       r=sum+5
for i in range(n):
       for j in range(m-1):
                     print(random.randrange(l,r), end=' ')
       print(random.randrange(l,r))


import sys,numpy as np
def find_nearest(array,value):
       idx = (np.abs(array-value)).argmin()
       return array[idx]
       
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(50):
       options.append(li.index(max[i])+1)
       
array=np.array(options)       
k=1
li=[]
query=m
rem=0
if c<=query:
       query=c
       rem=m-query

for i in range(query):
       print(2,1,n,k,k+1-1)
       sys.stdout.flush()
       sum=int(input())
       li.append((sum/(n)))
       #print m,k
       if k>=m:break
       k+=1
print(3)
       
for i in range(n):
       for j in range(query):
              print(str(find_nearest(array,li[j])), end=' ')
       print(" ".join([str(options[0])]*rem))

       


       

       


import sys,numpy as np
def find_nearest(array,value):
       idx = (np.abs(array-value)).argmin()
       return array[idx]
       
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(26):
       options.append(li.index(max[i])+1)
       
array=np.array(options)       
k=1
li=[]
query=m
rem=0
if c<=query:
       query=c
       rem=m-query

for i in range(query):
       print(2,1,n,k,k+1-1)
       sys.stdout.flush()
       sum=int(input())
       li.append((sum/(n)))
       #print m,k
       if k>=m:break
       k+=1
print(3)
       
for i in range(n):
       for j in range(query):
              print(str(find_nearest(array,li[j])), end=' ')
       print(" ".join([str(options[0])]*rem))

       


       

       


import sys,numpy as np
def find_nearest(array,value):
       idx = (np.abs(array-value)).argmin()
       return array[idx]
       
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,6):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(5):
       options.append(li.index(max[i])+1)
       
array=np.array(options)       
k=1
li=[]
query=m
rem=0
if c<=query:
       query=c
       rem=m-query

for i in range(query):
       print(2,1,n,k,k+1-1)
       sys.stdout.flush()
       sum=int(input())
       li.append((sum/(n)))
       #print m,k
       if k>=m:break
       k+=1
print(3)
       
for i in range(n):
       for j in range(query):
              print(str(find_nearest(array,li[j])), end=' ')
       print(" ".join([str(options[0])]*rem))

       


       

       


import sys,random
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(15):
       options.append(li.index(max[i])+1)
                     
print(3)
for i in range(n):
       for j in range(m-1):
              print(random.choice(options), end=' ')
       
       print(random.choice(options))

       
       

       


       

       


import sys,random
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(10):
       options.append(li.index(max[i])+1)
                     
print(3)
for i in range(n):
       for j in range(m-1):
              print(random.choice(options), end=' ')
       
       print(random.choice(options))

       
       

       


       

       


import sys,random
n,m,c=list(map(int,input().split()))
max=[]
li=[]
options=[]
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       max.append(ans)
       li.append(ans)
max.sort()
max=max[::-1]

for i in range(5):
       options.append(li.index(max[i])+1)
                     
print(3)
for i in range(n):
       for j in range(m-1):
              print(random.choice(options), end=' ')
       
       print(random.choice(options))

       
       

       


       

       


import sys
n,m,c=list(map(int,input().split()))
li=[]
max=0
for i in range(1,51):
       print(1,1,n,1,m,i,i)
       sys.stdout.flush()
       ans=int(input())
       if ans>max:
              max=ans
              deal=i

print(3)          
for i in range(n):
       print(" ".join([str(deal)]*m))

       
       

       


       

       


import sys
n,m,c=list(map(int,input().split()))

k=1
li=[]
query=m
rem=0
if c<=query:
       query=c
       rem=m-query

for i in range(query):
       print(2,1,n,k,k+1-1)
       sys.stdout.flush()
       sum=int(input())
       li.append(str(sum/(n)))
       #print m,k
       if k>=m:break
       k+=1
print(3)
       
for i in range(n):
       for j in range(query):
              print(li[j], end=' ')
       print(" ".join(["25"]*rem))

       


       

       


import sys
n,m,c=list(map(int,input().split()))

k=1
li=[]
query=m/n
rem=0
if c<=query:
       query=c
       rem=m-query*n

for i in range(query):
       print(2,1,n,k,k+n-1)
       sys.stdout.flush()
       sum=int(input())
       li.append(str(sum/(n*n)))
       #print m,k
       if k>=m:break
       k+=n
print(3)
       
for i in range(n):
       for j in range(query):
              print(" ".join([li[j]]*n), end=' ')
       print(" ".join(["25"]*rem))

       


       

       


import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		l = random.randint(1,25)
		h = random.randint(26,50)
		print(random.randint(l,h), end=' ')
	print("")

import random
n,m,c = list(map(int,input().split()))
print(3)
for i in range(n):
	for j in range(m):
		print(random.randint(1,50), end=' ')
	print("")