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