import sys input = lambda: sys.stdin.readline().rstrip() import random from time import time random.seed = 1 randint = random.randint random = random.random # ----------------------- # abcpqr = [tuple(map(int, input().split())) for _ in range(2048)] STIME = time() li = [[0, 0] for _ in range(2048)] for a,b,c,p,q,r in abcpqr: li[a][p] += 1 li[b][q] += 1 li[c][r] += 1 def make_ans_init() -> list: ans = [-1] * 2048 for a,b,c,p,q,r in abcpqr: if ans[a] != -1 or ans[b] != -1 or ans[c] != -1: continue ans[a] = p ans[b] = q ans[c] = r for i in range(2048): if ans[i] == -1: if li[i][0] < li[i][1]: ans[i] = 1 else: ans[i] = 0 return ans def eval_ans(ans) -> int: ret = 0 for a,b,c,p,q,r in abcpqr: if ans[a] == p and ans[b] == q and ans[c] == r: ret += 1 return ret def make_ans_yamanobori(ans): preans = ans[:] for _ in range(5): indx = randint(0, 2047) ans[indx] = 1 - ans[indx] return preans def main(): ans = make_ans_init() vestscore = eval_ans(ans) while time()-STIME < 1.8: nans = make_ans_yamanobori(ans) score = eval_ans(nans) if score > vestscore: ans = nans[:] vestscore = score print(''.join(map(str, reversed(ans)))) print(vestscore, file=sys.stderr) main()