import random
random.seed(239)
test = 29
maxV = 26 * 26 * 26
def int2hieroglyph(i):
  i %= maxV
  z = chr(65 + (i % 26))
  i /= 26
  z = chr(65 + (i % 26)) + z
  i /= 26
  z = chr(65 + i) + z;
  return z
def path(f,n):
  f.write("%d\n" % (n-1))
  for i in range(n-1):
    f.write(int2hieroglyph(i))
    for k in range(8):
      f.write(int2hieroglyph(random.randint(0,maxV-1)))
    f.write(int2hieroglyph(i+1) + "\n");
def cycle(f,n):
  f.write("%d\n" % n)
  for i in range(n):
    f.write(int2hieroglyph(i) + int2hieroglyph(random.randint(0,maxV-1)) + int2hieroglyph(i+1) + "\n");
def many_loops(f,n):
  f.write("%d\n" % n)
  for i in range(n):
    f.write(int2hieroglyph(i) + "\n");
def heap(f,n):
  f.write("%d\n" % (n-1))
  for i in range(1,n):
    f.write(int2hieroglyph(i) + int2hieroglyph(((i+1)>>1)-1) + "\n");
def heap2(f,n):
  f.write("%d\n" % (n-1))
  for i in range(1,n):
    f.write(int2hieroglyph(((i+1)>>1)-1) + int2hieroglyph(i) + "\n");

def small(f,n,ne):
  f.write("%d\n" % ne)
  for k in range(ne):
    i = random.randint(0,n-1) + 65
    j = random.randint(0,n-1) + 65
    f.write(chr(i)*3)
    f.write(chr(j)*3)  
    f.write("\n")
f = open("%02d" % test,"w")
test += 1
f.write("1\n");
f.write("ZZZZZY\n");
f.close()
################### 10 small random tests ###################
for i in range(10):
  f = open("%02d" % test,"w")
  test += 1
  small(f,5,10)
  f.close()
#############################################################
f = open("%02d" % test,"w")
test += 1
cycle(f,maxV)
f.close()
f = open("%02d" % test,"w")
test += 1
path(f,maxV)
f.close()
f = open("%02d" % test,"w")
test += 1
many_loops(f,maxV)
f.close()
f = open("%02d" % test,"w")
test += 1
heap(f,16384)
f.close()
f = open("%02d" % test,"w")
test += 1
heap2(f,16384)
f.close()
##################################
