Chef has found a new game and now he wants you to help him to get as much points as possible. 
Rules of the game: There are different types of game pieces -  geometric shapes composed of some amount of square blocks. In the picture below you can see all the types of figures and enumeration. 
The playing field is 10 cells width and 10 cells height. On each step of the game you are given exactly three game pieces. After that you need to put each of them to the game field such that after your move no two figures on the field are overlapped(you cannot rotate figures). If your move results in one or more horizontal or/and vertical lines of 10 units without gaps, those lines disappear. Notice that you put these three figures one by one and if you place the first figure and there are some lines ready to disappear, then they will disappear and only after that you place other figures.  
The game ends when you can't put no more figures on the game field.

-----Input-----
Each line of input contains three integers figure1, figure2 , figure3 denoting the type of the figures appeared on this step. If the game has ended - in the next line of input will be "-1 -1 -1". 

-----Interaction with the judge-----
In each step you should read from the standard input all information about figures that appear in this step. After receiving this input, you should print one line containing nine space-separated parameters id1, r1, c1, id2, r2, c2, id3, r3 and c3. Integers {id1, id2, id3} is the permutation of {1, 2, 3} and denote the order in which you will put these three figures. Integer ri denotes the number of the row of the lowest block of idith figure after you put it and ci denotes the number of the column of the leftmost block of idith figure after you put it. The rows are numbered from 1 to 10 from top to bottom and columns are numbered from 1 to 10 from left to right. Remember to flush the output after every line you print.
To finish the game(if you don't know where to put figures or it's impossible to put some figures) you need to output "-1" for figures you don't know where to put. For example, if on some move you don't know how to place all three figures, you need to output nine '-1"s as describing of all three figures. But if you can place, for example, only second figure, you need to output next numbers: "2 r1 c1 -1 -1 -1 -1 -1 -1". When judge reads "-1"s as describing of some figure, it means that the game ends at this step and then judge will output only "-1 -1 -1" as sign of finishing the game. 

-----Constraints-----
- 1 ≤ figurei ≤ 19
- Total amount of steps of the game does not exceed 5 * 104 

-----Scoring-----
- For each test case, your score will be the sum of areas(amount of square blocks figure consists) of figures that you correctly place in the playing field. Your goal is to maximise this score.
- Also there are some bonuses: if after your move exactly x row(s) and y column(s) will disappear - your score for this test will be increased by x2 + y2 + 5 * x *y and by 500 if after your move the field will be empty. 
- Your total score for the problem will be the sum of scores on all the test cases.
- Your solution will be tested only on 20% of the test files during the contest and will be re-judged against 100% after the end of competition.
- The game ends when you output "-1"s as describing of placing some figure(what means you want to finish the game) or total number of moves reached 5 * 104. In both cases the judge will output "-1 -1 -1" as a sing of finishing of the game.
- You will get WA verdict if you output incorrect data or some figures overlap. Incorrect data means that there is no way to put this figure at the place you output or you output completely incorrect data: idi ∉ {1, 2, 3},  {id1, id2, id3} is not the permutation of {1, 2, 3}, r ∉ [1..10] or c ∉ [1..10].
- If you passed all 5 * 104 steps of the game, the next line of input will be "-1 -1 -1" and your result will be the score you got.

-----Test data generation-----
For each test file the probabilities of appearing each figure are manually chosen.

-----Example-----
Input:
8 3 11
6 14 12
5 10 11
5 7 11
16 19 1
-1 -1 -1

Output:
3 6 5 2 2 2 1 10 8
1 4 8 2 6 1 3 7 2
1 5 8 3 4 8 2 6 8
3 9 8 2 10 7 1 1 6
3 10 8 2 8 3 -1 -1 -1

-----Explanation-----
In this test case your score will be 74 = 66 (for areas of figures) + 8 (bonus score).
On the fifth move the player decided to finish the game and output three "-1"s as the describing of placing the last figure on this move.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from sys import stdin,stdout\nfrom itertools import permutations\nfrom random import random\ndef printBS(li):\n s=[str(i) for i in li]\n print(" ".join(s))\n#grid defined as array 10x10 of 0\'s and 1\'s 1 means occupied\ngrid=[[0]*10 for i in range(10)]\nblocks=({1:[[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n        ,2:[[1,0,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n        ,3:[[1,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n        ,4:[[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 5:[[1,1,1,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 6:[[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0],[0,0,0,0,0]] \n       , 7:[[1,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n      ,  8:[[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0],[1,0,0,0,0]] \n     ,   9:[[1,1,1,1,1],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 10:[[1,1,0,0,0],[1,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 11:[[1,1,1,0,0],[1,1,1,0,0],[1,1,1,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 12:[[1,1,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 13:[[0,0,1,0,0],[0,0,1,0,0],[1,1,1,0,0],[0,0,0,0,0],[0,0,0,0,0]]  \n      ,  14:[[1,0,0,0,0],[1,0,0,0,0],[1,1,1,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 15:[[1,1,1,0,0],[1,0,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n       , 16:[[1,1,0,0,0],[1,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]  \n       , 17:[[1,1,0,0,0],[0,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n      ,  18:[[0,1,0,0,0],[1,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] \n        ,19:[[1,0,0,0,0],[1,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]})\nleftBelow={1:(0,0),2:(1,0),3:(0,0),4:(2,0),5:(0,0),6:(3,0),7:(0,0),8:(4,0),9:(0,0),10:(1,0),11:(2,0),12:(2,0),13:(2,0),14:(2,0),15:(2,0),16:(1,0),17:(1,0),18:(1,0),19:(1,0)}\npattern={1: "dot",2: "vert 2 line",3: "hor 2 line", 4: "vert 3",5: "hor 3",6:"vert 4",7: "hor 4", 8: "vert 5",9: "hor 5",10: "2*2",11:"3*3",12: " 3T3R", 13: "3R3B",14: "3L3B",15:"3L3T",16:"2L2T",17:"2R2T",18: "2R2B",19:"2L2B"}\ndef bounded(x,y):\n return 0<=x<=9 and 0<=y<=9\ndef adjzero(tempGrid,block,x,y):\n ones=0\n for i in range(5):\n  for j in range(5):\n   if bounded(x+i,y+j) and blocks[block][i][j]:\n    if bounded(x+i-1,y+j) and (i==0 or blocks[block][i-1][j]==0 )and tempGrid[x+i-1][y+j]==0: ones+=1\n    if bounded(x+i,y+j-1) and (j==0 or blocks[block][i][j-1]==0) and tempGrid[x+i][y+j-1]==0: ones+=1\n    if bounded(x+i,y+j+1) and (j==4 or blocks[block][i][j+1]==0) and tempGrid[x+i][y+j+1]==0: ones+=1\n    if bounded(x+i+1,y+j) and (i==4 or blocks[block][i+1][j]==0) and tempGrid[x+i+1][y+j]==0: ones+=1\n return ones\ndef adjnon(tempGrid,block,x,y):\n ones=0\n for i in range(5):\n  for j in range(5):\n   if bounded(x+i,y+j) and blocks[block][i][j]:\n    if bounded(x+i-1,y+j) and (i==0 or blocks[block][i-1][j]==0 )and tempGrid[x+i-1][y+j]: ones+=1\n    if bounded(x+i,y+j-1) and (j==0 or blocks[block][i][j-1]==0) and tempGrid[x+i][y+j-1]: ones+=1\n    if bounded(x+i,y+j+1) and (j==4 or blocks[block][i][j+1]==0) and tempGrid[x+i][y+j+1]: ones+=1\n    if bounded(x+i+1,y+j) and (i==4 or blocks[block][i+1][j]==0) and tempGrid[x+i+1][y+j]: ones+=1\n return ones\ndef boundary(tempGrid,block,x,y):\n bnd=0\n for i in range(5):\n  for j in range(5):\n   if blocks[block][i][j] and  (x+i+1==10 or x+i-1==-1): bnd+=1\n   if blocks[block][i][j] and(y+j+1==10 or y+j-1==-1): bnd+=1\n return bnd\ndef points(block,x,y):\n # creatw a local copy\n # place it on grid\n tempGrid=[i[:] for i in grid] \n for i in range(min(5,10-x)):\n  for j in range(min(5,10-y)):\n   if blocks[block][i][j]==1:\n    tempGrid[i+x][j+y]=block\n #calculate lines heuristics\n lines=0\n for i in range(10):\n  for j in range(10):\n   if tempGrid[i][j]==0: break\n  else: lines+=1\n for j in range(10):\n  for i in range(10):\n   if tempGrid[i][j]==0: break\n  else: lines+=1\n #caculatw nearby non zeroes\n nearby=adjnon(tempGrid,block,x,y)\n nearholes=adjnon(tempGrid,block,x,y)\n #calculate boundary close points\n bndcls=boundary(tempGrid,block,x,y)\n return 20.0*lines+0.25*nearby+0.5*bndcls\ndef clearLine(lineNo,isRow):\n if isRow:\n  for i in range(10):\n   grid[lineNo][i]=0\n else:\n  for i in range(10):\n   grid[i][lineNo]=0\ndef placeBlock(block,x,y):\n for i in range(min(5,10-x)):\n  for j in range(min(5,10-y)):\n   if blocks[block][i][j]==1:\n    grid[i+x][j+y]=block\ndef clearFilledLines():\n #check horizontal\n horz=[]\n for i in range(10):\n  for j in range(10):\n   if grid[i][j]==0: break\n  else: horz.append(i)\n vertz=[]\n #check vertical\n for j in range(10):\n  for i in range(10):\n   if grid[i][j]==0: break\n  else: vertz.append(j)\n for i in horz: clearLine(i,True)\n for i in vertz: clearLine(i,False)\ndef printGrid():\n for i in range(10):\n  for j in range(10):\n   print("%02d"%grid[i][j], end=\' \')\n  print()\ndef checkPos(x,y,block):\n for i in range(5):\n  for j in range(5):\n   if blocks[block][i][j]:\n    if x+i>9 or y+j>9: return False\n    if grid[i+x][j+y]: return False\n return True\ndef findPos(block):\n pos=[]\n for i in range(10):\n  for j in range(10):\n   if checkPos(i,j,block) : \n    pos.append((points(block,i,j),i,j))\n #print pos\n if pos: return max(pos)\n return (-1,-1,-1)\nwhile True:\n a,b,c=list(map(int,stdin.readline().split()))\n if (a,b,c)==(-1,-1,-1): break\n li=[(a,1),(b,2),(c,3)]\n perms=permutations(li)\n maxp=[]\n maxv=-10\n pos=[]\n for p in perms:\n  tempGrid=[i[:] for i in grid]\n  t1=findPos(p[0][0])\n  if t1!=(-1,-1,-1):\n   placeBlock(p[0][0],t1[1],t1[2])\n   clearFilledLines()\n  t2=findPos(p[1][0])\n  if t2!=(-1,-1,-1):\n   placeBlock(p[1][0],t2[1],t2[2])\n   clearFilledLines()\n  t3=findPos(p[2][0])\n  if t3!=(-1,-1,-1):\n   placeBlock(p[2][0],t3[1],t3[2])\n   clearFilledLines()\n  if (t1[0]+t2[0]+t3[0])>maxv:\n   maxv=(t1[0]+t2[0]+t3[0])\n   pos=[t1[1:],t2[1:],t3[1:]]\n   maxp=p\n  grid=tempGrid\n outstr=[]\n count=0\n for pi in range(len(maxp)):\n  if pos[pi][0]!=-1:\n    i=maxp[pi]\n    x=pos[pi][0]\n    y=pos[pi][1]\n    #print x,y\n    placeBlock(i[0],x,y)\n    clearFilledLines()\n    #printGrid()\n    outstr.extend([i[1],x+1+leftBelow[i[0]][0],y+1])\n    count+=1\n for i in range(3-count):\n  outstr.extend([-1,-1,-1])\n printBS(outstr)\n stdout.flush()\n '
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 48602