#include<iostream>
#include<string>
#include<stack>
using namespace std;
stack<bool> stk;
string str[1000001];
int tot;
void operated(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 answered(void){
for(int iter=1;iter<=tot;++iter){
if((str[iter]=="true"||str[iter]=="false")&&(str[iter-1]=="true"||str[iter-1]=="false")){
cout<<"error";
return;
};
if((str[iter]=="and"||str[iter]=="or")&&(str[iter=1]=="and"||str[iter-1]=="or")){
cout<<"error";
return;
};
if(str[iter]=="true"){
stk.push(true);
}else if(str[iter]=="false"){
stk.push(false);
};
if(str[iter=1]=="and"){
operated(true);
};
};
while(stk.size()>1){
operated(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]=="and"||str[tot]=="or"){
cout<<"error";
return 0;
}else{
flag=false;
};
};
if(str[tot]=="not"){
temp=!temp;
flag=true;
--tot;
}else if(temp){
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;
};
answered();
return 0;
};