#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

map<string, bitset<256> > variable;

bitset<256> setValue(const string& s)
{
    if(variable.find(s) != variable.end())
        return variable[s];

    istringstream iss(s);
    int a;
    iss >> a;
    bitset<256> bs;
    bs[a] = true;
    return bs;
}

bool solve()
{
    int m;
    cin >> m;
    for(int i=0; i<m; ++i){
        string s;
        int lb, ub;
        cin >> s >> lb >> ub;

        bitset<256> bs;
        for(int i=lb; i<=ub; ++i)
            bs[i] = true;
        variable[s] = bs;
    }

    int n;
    cin >> n;
    stack<bitset<256> > stk;
    for(int i=0; i<n; ++i){
        string s;
        cin >> s;
        if(isalnum(s[0])){
            stk.push(setValue(s));
        }else{
            bitset<256> b = stk.top();
            stk.pop();
            bitset<256> a = stk.top();
            stk.pop();

            bitset<256> c;
            if(s[0] == '+'){
                for(int i=0; i<256; ++i){
                    for(int j=0; j<256; ++j){
                        if(a[i] && b[j])
                            c[(i+j)%256] = true;
                    }
                }
            }else if(s[0] == '-'){
                for(int i=0; i<256; ++i){
                    for(int j=0; j<256; ++j){
                        if(a[i] && b[j])
                            c[(i-j+256)%256] = true;
                    }
                }
            }else if(s[0] == '*'){
                for(int i=0; i<256; ++i){
                    for(int j=0; j<256; ++j){
                        if(a[i] && b[j])
                            c[(i*j)%256] = true;
                    }
                }
            }else{
                if(b[0])
                    return false;
                for(int i=0; i<256; ++i){
                    for(int j=0; j<256; ++j){
                        if(a[i] && b[j])
                            c[(i/j)%256] = true;
                    }
                }
            }
            stk.push(c);
        }
    }

    return true;
}

int main()
{
    if(solve())
        cout << "correct" << endl;
    else
        cout << "error" << endl;

    return 0;
}