#include<iostream>
#include<string>
#include<stack>
using namespace std;
stack<bool> stk;
string str[1000001];
int tot;
bool tmp;
void operate1(bool key){
bool top1=stk.top();
stk.pop();
bool top2=stk.top();
stk.pop();
if(key){
stk.push(top1&&top2);
}else{
stk.push(top1||top2);
};
};
void operate2(void){
for(int iter=1;iter<=tot;++iter){
if((str[iter]=="true"||str[iter]=="false")&&(str[iter-1]=="true"||str[iter-1]=="false")){
tmp=true;
return;
};
if((str[iter]=="and"||str[iter]=="or")&&(str[iter=1]=="and"||str[iter-1]=="or")){
tmp=true;
return;
};
if(str[iter]=="true"){
stk.push(true);
}else if(str[iter]=="false"){
stk.push(false);
};
if(str[iter=1]=="and"){
operate1(true);
};
};
while(stk.size()>1){
operate1(false);
};
if(stk.top()){
cout<<"true";
}else{
cout<<"false";
};
};
int main(void){
bool temp=false;
bool flag=false;
while(cin>>str[++tot]){
if(flag){
if(str[tot]!="true"&&str[tot]!="false"&&str[tot]!="not"){
cout<<"error";
return 0;
}else{
flag=false;
};
};
if(str[tot]=="not"){
temp^=true;
flag=true;
--tot;
}else if(temp==1){
if(str[tot]=="true"){
str[tot]=="false";
}else{
str[tot]="true";
};
temp=false;
};
};
if(str[1]=="and"||str[1]=="or"||str[tot]=="and"||str[tot]=="or"||str[tot]=="not"){
cout<<"error";
return 0;
};
operate2();
if(tmp){
cout<<"error";
};
return 0;
};