""#line:4
__all__ =[]#line:6
class OO0O0O000O0O0O000 :#line:8
""#line:9
def __init__ (O0OO000O0O0O0OOOO ,OOO0OO0000OO0O000 ):#line:11
O0OO000O0O0O0OOOO .__O00O000O000000O00 =OOO0OO0000OO0O000 #line:13
O0OO000O0O0O0OOOO .__OOO0000O0OO000OO0 =0 #line:14
O0OO000O0O0O0OOOO .__OOOO00O00OOOO000O ()#line:15
def __OOOO00O00OOOO000O (OOOOOO0OO0OOO00OO ):#line:17
""#line:18
OOO0OO0O0O0O0O00O =[-1 ]*OOOOOO0OO0OOO00OO .__O00O000O000000O00 #line:19
OOOOOO0OO0OOO00OO .__O0O000000OOOO0000 (OOO0OO0O0O0O0O00O ,0 )#line:20
print ("Found",OOOOOO0OO0OOO00OO .__OOO0000O0OO000OO0 ,"solutions.")#line:21
def __O0O000000OOOO0000 (O0OOOOOO00OO0OO00 ,OO000O0O000O000OO ,OO0O0OOOOOO000000 ):#line:23
""#line:28
if OO0O0OOOOOO000000 ==O0OOOOOO00OO0OO00 .__O00O000O000000O00 :#line:30
O0OOOOOO00OO0OO00 .__O000000O0O000000O (OO000O0O000O000OO )#line:31
O0OOOOOO00OO0OO00 .__OOO0000O0OO000OO0 +=1 #line:32
else :#line:33
for O0O0OOO0OO0O0OO0O in range (O0OOOOOO00OO0OO00 .__O00O000O000000O00 ):#line:35
if O0OOOOOO00OO0OO00 .__OO00OOOOO000O0O00 (OO000O0O000O000OO ,OO0O0OOOOOO000000 ,O0O0OOO0OO0O0OO0O ):#line:37
OO000O0O000O000OO [OO0O0OOOOOO000000 ]=O0O0OOO0OO0O0OO0O #line:38
O0OOOOOO00OO0OO00 .__O0O000000OOOO0000 (OO000O0O000O000OO ,OO0O0OOOOOO000000 +1 )#line:39
def __OO00OOOOO000O0O00 (OOO0O0000O00O00O0 ,O0O000OO0OO0OOO0O ,O0O0O00O00OO00000 ,OO0OO0OOO00O00000 ):#line:42
""#line:46
for OO00000O0000OO000 in range (O0O0O00O00OO00000 ):#line:47
if O0O000OO0OO0OOO0O [OO00000O0000OO000 ]==OO0OO0OOO00O00000 or O0O000OO0OO0OOO0O [OO00000O0000OO000 ]-OO00000O0000OO000 ==OO0OO0OOO00O00000 -O0O0O00O00OO00000 or O0O000OO0OO0OOO0O [OO00000O0000OO000 ]+OO00000O0000OO000 ==OO0OO0OOO00O00000 +O0O0O00O00OO00000 :#line:50
return False #line:52
return True #line:53
def __O000000O0O000000O (O0OOOOOO0OO0000OO ,OO00OO0O0O0OOO0OO ):#line:55
""#line:56
for OO0O0O000OO00O000 in range (O0OOOOOO0OO0000OO .__O00O000O000000O00 ):#line:57
OOOO00OOO0000O000 =""#line:58
for O0OOO0OO0O000OOO0 in range (O0OOOOOO0OO0000OO .__O00O000O000000O00 ):#line:59
if OO00OO0O0O0OOO0OO [OO0O0O000OO00O000 ]==O0OOO0OO0O000OOO0 :#line:60
OOOO00OOO0000O000 +="Q "#line:61
else :#line:62
OOOO00OOO0000O000 +=". "#line:63
print (OOOO00OOO0000O000 )#line:64
print ("
")#line:65
def __O0O00OOO00O0O0OOO (O0OO0OOO0O0O0000O ,OO0O00OOO000O00OO ):#line:67
""#line:71
O0OO0O00OOOO0000O =""#line:72
for O00000O000O00OOOO in range (O0OO0OOO0O0O0000O .__O00O000O000000O00 ):#line:73
O0OO0O00OOOO0000O +=str (OO0O00OOO000O00OO [O00000O000O00OOOO ])+" "#line:74
print (O0OO0O00OOOO0000O )#line:75
def OO00OO00OOO00OOO0 ():#line:77
""#line:78
OO0O0O000O0O0O000 (8 )#line:79
if __name__ =="__main__":#line:81
OO00OO00OOO00OOO0 ()#line:83