#include using namespace std; int main() { int n; cin >> n; string s = "A="; int cnt = 0; for (int j = 0; j < (1 << n); j++) { string tmp = ""; for (int i = 0; i < n; i++) { if (i > 0) tmp += "∧"; int x; cin >> x; if (x == 0) tmp += "¬"; tmp += "P_" + to_string(i+1); } int r; cin >> r; if (r == 1) { if (cnt > 0) { s += "∨"; } s += "(" + tmp + ")"; cnt++; } } if (cnt == 0) cout << "A=⊥" << endl; else if (cnt == (1 << n)) cout << "A=⊤" << endl; else cout << s << endl; return 0; }