import random
random.seed (10111)
test = 11
maxW = 9
maxH = 9
def out(f,piece,w,h):
  f.write("%d %d\n" % (w,h))
  f.write(piece)

def popcount(a):
  if (a == 0): return 0
  return 1 + popcount(a & (a-1))

def visit(a,i):
  if (0 == (a & (1 << i))) : return a, 0
  r = 1;
  a ^= 1 << i
  x = i % 3
  y = i / 3
  if (x > 0) : b, s = visit(a,i-1); a &= b; r += s
  if (x < 2) : b, s = visit(a,i+1); a &= b; r += s
  if (y > 0) : b, s = visit(a,i-3); a &= b; r += s
  if (y < 2) : b, s = visit(a,i+3); a &= b; r += s
  return a, r
def check(a):
  if popcount(a) != 6: return 0
  for j in range(9):
    if a & (1<<j) : return visit(a,j) == (0, 6)
def getpiece(a):
  z = ""
  for j in range(3):
    for i in range(3):
      if a & (1 << (3*j+i)): z = z + 'X'
      else: z = z + '.'
    z = z + "\n"
  return z
pieces = []  
for i in range(1<<9):
  if check(i): pieces.append(getpiece(i))
################################################
#pieces - list of all possible pieces as string#
################################################
#for i in range (len (pieces)):
#	print 'Piece %d:' % (i + 1)
#	print "%s" % pieces[i]
for i in range(41):
  f = open ('%02d' % test, 'w')
  test += 1
  out(f,random.choice(pieces),random.randint(1,maxW),random.randint(1,maxH))
  f.close()
for i in pieces:
  f = open ('%02d' % test, 'w')
  test += 1
#  out (f, i, random.randint (maxW - 1, maxW), random.randint (maxH - 1, maxH))
  out (f, i, 9, 9)
  f.close()
