while 1: t=input() for i in range(3): for j in range(3):print 1&0x2db55a2c448810>>3*i+j+t*9-9, print print