#include using namespace std; using i8 = int8_t;using i16 = int16_t;using i32 = int32_t;using i64 = int64_t;using i128 = __int128_t;using u8 = uint8_t;using u16 = uint16_t;using u32 = uint32_t;using u64 = uint64_t;using u128 = __uint128_t;using f32 = float;using f64 = double;using f80 = long double; using vi32 = vector;using vi64 = vector;using vu32 = vector;using vu64 = vector; using vvi32 = vector>;using vvi64 = vector>;using vvu32 = vector>;using vvu64 = vector>; using pi32 = pair;using pi64 = pair;using pu32 = pair;using pu64 = pair; using vpi32 = vector;using vpi64 = vector;using vpu32 = vector;using vpu64 = vector; const i64 Mod = 1e9+7; int main() { int n; cin >> n; vector res; vector q(n); int r; for (int i = 0; i < (1 << n); i++) { for (int j = 0; j < n; j++) cin >> q[i]; cin >> r; if (r == 1) { string expr = ""; for (int j = 0; j < n; j++) { if (j) expr += "∧"; if (q[j] == 0) expr += "¬P_" + to_string(j + 1); else expr += "P_" + to_string(j + 1); } res.push_back(expr); } } if (res.size() == 0) cout << "A=⊥" << endl; else if (res.size() == (1 << n)) cout << "A=⊤" << endl; else { int m = res.size(); string ans = "A="; for (int i = 0; i < m; i++) { if (i) ans += "∨"; ans += "(" + res[i] + ")"; } cout << ans << endl; } return 0; }