import math
k=int(input())
x,y=map(int,input().split())
length=pow(2,k)
#x1,y1 Where the princess is x2,y2 The upper left corner of the square
def solve(x1,y1,x2,y2,length):
if(length==1):
return
if(x1-x2<=length/2-1 and y1-y2<=length/2-1):# top left corner
print(int(x2+length/2),end=' ')
print(int(y2+length/2),end=' ')
print(1)
solve(x1,y1,x2,y2,length/2)# Upper left square
solve(x2+length/2-1,y2+length/2,x2,y2+length/2,length/2)# Lower left square
solve(x2+length/2,y2+length/2-1,x2+length/2,y2,length/2)# The upper right
solve(x2+length/2,y2+length/2,x2+length/2,y2+length/2,length/2)# Small square at the bottom right
elif (x1-x2<=length/2-1 and y1-y2>length/2-1):# The lower left corner
print(int(x2+length/2),end=' ')
print(int(y2+length/2-1),end=' ')
print(2)
solve(x2+length/2-1,y2+length/2-1,x2,y2,length/2)# Upper left square
solve(x1,y1,x2,y2+length/2,length/2)# Lower left square
solve(x2+length/2,y2+length/2-1,x2+length/2,y2,length/2)# The upper right
solve(x2+length/2,y2+length/2,x2+length/2,y2+length/2,length/2)# Small square at the bottom right
elif (x1-x2>length/2-1 and y1-y2<=length/2-1):# Upper right corner
print(int(x2+length/2-1),end=' ')
print(int(y2+length/2),end=' ')
print(3)
solve(x2+length/2-1,y2+length/2-1,x2,y2,length/2)# Upper left square
solve(x2+length/2,y2+length/2,x2,y2+length/2,length/2)# Lower left square
solve(x1,y1,x2+length/2,y2,length/2)# The upper right
solve(x2+length/2,y2+length/2,x2+length/2,y2+length/2,length/2)# Small square at the bottom right
else:
print(int(x2+length/2-1),end=' ')
print(int(y2+length/2-1),end=' ')
print(4)
solve(x2+length/2-1,y2+length/2-1,x2,y2,length/2)# Upper left square
solve(x2+length/2-1,y2+length/2,x2,y2+length/2,length/2)# Lower left square
solve(x2+length/2,y2+length/2-1,x2+length/2,y2,length/2)# The upper right
solve(x1,y1,x2+length/2,y2+length/2,length/2)# Small square at the bottom right
solve(x,y,1,1,length)
Jane. Suke: Cet article donne