n = int(input()) ans = [[] for _ in range(n ** 2)] not_all_ok_flg = False not_all_ng_flg = False for i in range(len(ans)): tmp = [int(x) for x in input().split()] q = [tmp[i] for i in range(n)] r = tmp[-1] if r == 1: ans[i] = [False for _ in range(n)] for j, v in enumerate(q): if v == 1: ans[i][j] = True not_all_ng_flg = True else: not_all_ok_flg = True print("A=", end="") if not not_all_ng_flg: print("⊥") elif not not_all_ok_flg: print("⊤") else: flg = False for ans_i in ans: if len(ans_i) == 0: continue if flg: print("∨", end="") print("(", end="") for j, v in enumerate(ans_i): if j != 0: print("∧", end="") if not v: print("¬", end="") print("P_", j + 1, sep="", end="") print(")", end="") flg = True print()