s = [input() for i in range(32)] for i in range(32): print(+('01' or '23' in s[i]))