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