#include <bits/stdc++.h>
  
using namespace std;
 
#define MAX 256
typedef pair<int, int> pii;
  
int n;
vector<string> e;
map<string, pii> mp;
  
int op_num(char c)
{
    switch (c) {
        case '+':
            return 0;
        case '-':
            return 1;
        case '*':
            return 2;
        case '/':
            return 3;
    }
    return -1;
}
  
int s2i(string &s)
{
    int res;
    stringstream ss(s);
    ss >> res;
    return res;
}

int calc(int a, int op, int b)
{
    if (op == 0) {
        return (a + b) % 256;
    } else if (op == 1) {
        return (a - b + 256) % 256;
    } else if (op == 2) {
        return (a * b) % 256;
    } else {
        return (a / b) % 256;
    }
}

bool zero_division_checker()
{
    stack<int> st;
    stack<vector<int>> st2;
    for (int i = 0; i < n; i++) {
        if (isdigit(e[i][0])) {            
            st.push(s2i(e[i]));
        } else {
            int op = op_num(e[i][0]);
            if (op >= 0) {
                int b = st.top(); st.pop();
                int a = st.top(); st.pop();
                vector<int> v;
                if (a == MAX) {
                    if (b == MAX) {
                        vector<int> vb = st2.top(); st2.pop();
                        vector<int> va = st2.top(); st2.pop();
                        for (int j = 0; j < (int)va.size(); j++) {
                            for (int k = 0; k < (int)vb.size(); k++) {
                                if (op == 3 && vb[k] == 0) {
                                    return false;
                                }
                                v.push_back(calc(va[j], op, vb[k]));
                            }
                        }
                    } else {
                        if (op == 3 && b == 0) {
                            return false;
                        }
                        vector<int> va = st2.top(); st2.pop();
                        for (int j = 0; j < (int)va.size(); j++) {
                            v.push_back(calc(va[j], op, b));
                        }                        
                    }
                    sort(v.begin(), v.end());
                    v.erase(unique(v.begin(), v.end()), v.end());
                    st.push(MAX);
                    st2.push(v);
                } else {
                    if (b == MAX) {
                        vector<int> vb = st2.top(); st2.pop();
                        for (int j = 0; j < (int)vb.size(); j++) {
                            if (op == 3 && vb[j] == 0) {
                                return false;
                            }
                            v.push_back(calc(a, op, vb[j]));
                        }
                        sort(v.begin(), v.end());
                        v.erase(unique(v.begin(), v.end()), v.end());
                        st.push(MAX);
                        st2.push(v);
                    } else {
                        if (op == 3 && b == 0) {
                            return false;
                        }
                        st.push(calc(a, op, b));       
                    }
                }                    
            } else {
                vector<int> v;
                pii p = mp[e[i]];
                for (int j = p.first; j <= p.second; j++) {
                    v.push_back(j);
                }
                st.push(MAX);
                st2.push(v);                
            }
        }
    }
    return true;
}
  
int main()
{
    int m;
    cin >> m;
    string name;
    int lb, ub;
    for (int i = 0; i < m; i++) {
        cin >> name >> lb >> ub;
        mp[name] = pii(lb, ub);
    }
    cin >> n;
    e.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> e[i];
    }
    cout << (zero_division_checker() ? "correct" : "error") << endl;
    return 0;
}

Measured memory_bytes: 3388