n = int(input())↵
s = []↵
for i in range(n):↵
s.append([])↵
for u in range(n):↵
f = list(map(int,input().split()))↵
o = 0↵
for elem in f:↵
o += 1↵
if elem == 1:↵
s[u].append(o)↵
w = list(map(int,input().split()))↵
for op in s:↵
for elem in op:↵
↵
s = []↵
for i in range(n):↵
s.append([])↵
for u in range(n):↵
f = list(map(int,input().split()))↵
o = 0↵
for elem in f:↵
o += 1↵
if elem == 1:↵
s[u].append(o)↵
w = list(map(int,input().split()))↵
for op in s:↵
for elem in op:↵
↵