from os import system
from random import randint

n=3

while True:
    f = open("hirviot.in","w")
    f.write(str(n)+"\n")
    for i in range(n):
        s = ""
        for j in range(n):
            s += ".*"[randint(0,1)]
        f.write(s + "\n")
    f.close()
    system("./hirviot < hirviot.in > hirviot.out1")
    system("./hirviot2 < hirviot.in > hirviot.out2")
    o1 = open("hirviot.out1").readlines()
    o2 = open("hirviot.out2").readlines()
    if o1 == o2:
        print("ok")
    else:
        print("!!!")
        exit(0)
    