cnot = chr(172) cand = chr(8743) cor = chr(8744) ctop = chr(8868) cbot = chr(8869) def main(): n = int(input()) all = True ans = "" for _ in range(2 ** n): v = list(map(int, input().split())) if v[-1] == 0: all = False continue ans += "A=" if len(ans) == 0 else cor ans += "(" for i in range(n): if i != 0: ans += cand if v[i] == 0: ans += cnot ans += "P_" ans += str(i + 1) ans += ")" if len(ans) == 0: ans = "A=" + cbot if all: ans = "A=" + ctop print(ans) def checkord(): s = input() for c in s: print(c, ord(c)) if __name__ == "__main__": # checkord() main()