1630: 地毯填补问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:13 Solved:12

Description

相传在一个古老的阿拉伯国家里,有一座宫殿。宫殿里有个四四方方的格子迷宫,国王选择驸马的方法非常特殊,也非常简单:公主就站在其中一个方格子上,只要谁能用地毯将除公主站立的地方外的所有地方盖上,美丽漂亮聪慧的公主就是他的人了。公主这一个方格不能用地毯盖住,毯子的形状有所规定,只能有四种选择(如图):


并且每一方格只能用一层地毯,迷宫的大小为 lns="http://www.w3.org/1998/Math/MathML">2^k\times 2^k 的方形。当然,也不能让公主无限制的在那儿等,对吧?由于你使用的是计算机,所以实现时间为 lns="http://www.w3.org/1998/Math/MathML">1 秒。

Input

输入文件共 lns="http://www.w3.org/1998/Math/MathML">2 行。

第一行一个整数 lns="http://www.w3.org/1998/Math/MathML">k,即给定被填补迷宫的大小为 lns="http://www.w3.org/1998/Math/MathML">2^k\times 2^klns="http://www.w3.org/1998/Math/MathML">0\lt k\leq 10); 第二行两个整数 lns="http://www.w3.org/1998/Math/MathML">x,y,即给出公主所在方格的坐标(lns="http://www.w3.org/1998/Math/MathML">x 为行坐标,lns="http://www.w3.org/1998/Math/MathML">y 为列坐标),lns="http://www.w3.org/1998/Math/MathML">x 和 lns="http://www.w3.org/1998/Math/MathML">y 之间有一个空格隔开。

Output

将迷宫填补完整的方案:每一补(行)为 lns="http://www.w3.org/1998/Math/MathML">x\ y\ clns="http://www.w3.org/1998/Math/MathML">x,y 为毯子拐角的行坐标和列坐标,lns="http://www.w3.org/1998/Math/MathML">c 为使用毯子的形状,具体见上面的图 lns="http://www.w3.org/1998/Math/MathML">1,毯子形状分别用 lns="http://www.w3.org/1998/Math/MathML">1,2,3,4 表示,lns="http://www.w3.org/1998/Math/MathML">x,y,c 之间用一个空格隔开)。

Sample Input Copy

3
3 3

Sample Output Copy

5 5 1
2 2 4
1 1 4
1 4 3
4 1 2
4 4 1
2 7 3
1 5 4
1 8 3
3 6 3
4 8 1
7 2 2
5 1 4
6 3 2
8 1 2
8 4 1
7 7 1
6 6 1
5 8 3
8 5 2
8 8 1

HINT