#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int ll const MOD = 1000000007; ll const INF = (long long int)1 << 61; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; ll t = 1 << n; vector> q(n,vector(t)); vector r(t); for(int i = 0; i < t; i++){ int tmp; for(int j = 0; j < n; j++){ cin >> tmp; q[j][i] = (bool)tmp; } cin >> tmp; r[i] = (bool)tmp; } bool allt = true; bool allf = true; int c = 0; for(int i = 0; i < t; i++){ if(r[i])c++; allt = allt && r[i]; allf = allf && (!r[i]); } if(allt){ cout << "A=⊤"; return 0; } if(allf){ cout << "A=⊥"; return 0; } string ans = "A="; bool flag = false; for(int i = 0; i < t; i++){ if(r[i]){ if(flag){ ans += "∨"; } if(c > 1){ ans += "("; } for(int j = 0; j < n; j++){ if(j > 1){ ans += "∧"; } if(!q[j][i]){ ans += "¬"; } ans += "P_"; ans += to_string(i+1); } if(c > 1){ ans += ")"; } flag = true; } } cout << ans << endl; return 0; }