from collections import deque
move=[(-1,0),(1,0),(0,-1),(0,1)]#위 아래 왼 오
for tc in range(1,10+1):
t=int(input())
arr=[list(map(int,input())) for _ in range(16)]
q= deque()
q.append((1,1))
res=0
while q:
x,y=q.popleft()
if arr[x][y]==3:
res=1
break
arr[x][y]=1
for i in range(4):
mx=x+move[i][0]
my=y+move[i][1]
if 0<=mx<16 and 0<=my<16 and arr[mx][my]!=1:
q.append((mx,my))
print(f'#{tc} {res}')
주어진 값을 입력하는 코드를 작성할때 split()을 붙여야할 경우와 아닌 경우를 구별할 것