#include using namespace std; #define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i)) using ll = long long; using P = pair; using namespace std; template void vin(vector& v, int n) { v.resize(n); for (int i = 0; i < n; ++i) { cin >> v[i]; } } int q[5000][13]; int r[5000]; int main() { int N; cin >> N; int one = 0, zero = 0; rep(i, pow(2, N)) { rep(j, N) cin >> q[i][j]; cin >> r[i]; if (r[i]) one++; else zero++; } if (one == pow(2, N)) { cout << "A=⊤" << endl; } else if (zero == pow(2, N)) { cout << "A=⊥" << endl; } else { string ans = ""; rep(i, pow(2, N)) { if (r[i]) { if (ans.size()) ans += "∨"; ans += "("; // rep(j, N) { if (j) ans += "∧"; if (q[i][j] == 0) { ans += "¬"; } ans += "P_" + to_string(j+1); } ans += ")"; } } cout << "A=" << ans << endl; } }