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