#include<bits/stdc++.h>
using namespace std;
int main()
{
string s,str;
stack<string> tmp;
getline(cin, str);
stringstream ss(str);
while (ss >> s)
{
if (s == "and" || s == "or")
{
if (tmp.empty() || tmp.top() == "and" || tmp.top() == "or")
{
cout << "error" << endl;
while (!tmp.empty())tmp.pop();
break;
}
else tmp.push(s);
}
else
{
if (tmp.empty())tmp.push(s);
else if (tmp.top() == "true" || tmp.top() == "false")
{
cout << "error" << endl;
while (!tmp.empty())tmp.pop();
break;
}
else if (tmp.top() == "and")
{
tmp.pop();
string s_1 = tmp.top();
tmp.pop();
if (s_1 == "true"&&s == "true")
tmp.push("true");
else tmp.push("false");
}
else
tmp.push(s);
}
}
if (!tmp.empty() && (tmp.top() == "or" || tmp.top() == "and"))
{
cout << "error" << endl;
while (!tmp.empty())tmp.pop();
//break;
}
while (!tmp.empty())
{
if (tmp.top() == "true")
{
cout << "true" << endl;
break;
}
if (tmp.size() == 1 && tmp.top() == "false")
{
cout << "false" << endl;
break;
}
tmp.pop();
}
}