#include<bits/stdc++.h>
using namespace std;
int t,l=10,k;
string s[300];
queue <int> f1;
stack <int> f2;
stack <int> n;
int main()
{
while (cin >> s[++t])
{
if (s[t]=="true") k=1;
if (s[t]=="false") k=2;
if (s[t]=="not") k=3;
if (s[t]=="and") k=4;
if (s[t]=="or") k=5;
if (l<3&&k<3||l>2&&k>3)
{
cout << "error";
return 0;
}
l=k;
if (k<3) f1.push(k);
else
{
while (!f2.empty()&&f2.top()<=k) f1.push(f2.top()),f2.pop();
f2.push(k);
}
}
while (!f2.empty()) f1.push(f2.top()),f2.pop();
while (!f1.empty())
{
if (f1.front()<3)
{
n.push(f1.front());
}
else if (f1.front()==3)
{
if (n.empty()){cout << "error";return 0;}
int x=n.top();
n.pop();
n.push(3-x);
}
else if (f1.front()==4)
{
if (n.empty()){cout << "error";return 0;}
int x=n.top();
n.pop();
if (n.empty()){cout << "error";return 0;}
int y=n.top();
n.pop();
n.push((x==1&&y==1?1:2));
}
else
{
if (n.empty()){cout << "error";return 0;}
int x=n.top();
n.pop();
if (n.empty()){cout << "error";return 0;}
int y=n.top();
n.pop();
n.push((x==2&&y==2?2:1));
}
f1.pop();
}
cout << (n.top()==1?"true":"false");
return 0;
}