#include <iostream> #include <cmath> #include <string> #include <vector> using namespace std; int main(){ int n; cin >> n; int pn=int(pow(2, n)); vector<vector<int>>t(pn, vector<int>(n+1)); for(int i=0; i<pn; i++){ for(int j=0; j<n+1; j++){ cin >> t[i][j]; } } vector<string>ret; for(int i=0; i<pn; i++){ if(t[i][n]){ string str=""; str.push_back('('); for(int j=0; j<n; j++){ if(!t[i][j])str+="¬"; str+="P_"+to_string(j+1); if(j!=n-1)str+="∧"; } str.push_back(')'); ret.push_back(str); } } cout << "A="; if(ret.size()==0)cout << "⊥"; else if(ret.size()==pn)cout << "⊤"; else{ for(int i=0; i<ret.size(); i++){ cout << ret[i]; if(i!=ret.size()-1)cout << "∨"; } } cout << endl; return 0; }