#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<> s; return s; } int main(){ ll n; cin>>n; ll c = 0; string s = "A="; rep(i,0,pow(2,n)){ string s1 = "("; vector v; rep(j,1,n+1){ ll a; cin>>a; if(a)s1+="P_"+ntos(j); else s1+="¬P_"+ntos(j); if(j!=n)s1+="∧"; else s1+=")"; } ll a; cin>>a; if(a==1){ if(s.sz!=2)s+="∨"; s+=s1; c++; } } if(c==0){ cout << "A=⊥" << endl; } else if(c==pow(2,n)){ cout << "A=⊤" << endl; } else{ cout << s << endl; } return 0; }