B=[] for i in range(9): B.append(input()) for l in range(9): if B[l] is not l+1: answer=l+1 print(answer)