#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0, 0,-1,1,-1, 1,-1};
int dy[]={0,1,-1, 0,1,-1,-1, 1};



int main(){
    int m;cin >> m;
    vector<string> s(m);
    vector<int> l(m),r(m);
    unordered_map<string,vector<bool>> val;
    for (int i = 0; i < m; i++) {
        cin >> s[i] >> l[i] >> r[i];
        r[i]++;
        vector<bool> v(256,false);
        for (int j = l[i]; j < r[i]; j++) {
            v[j] = true;
        }
        val[s[i]] = v;
    }
    int n;cin >> n;
    stack<string> st;
    bool f = false;
    vector<int> c(10,0);
    for (int i = 0; i < n; i++) {
        string t;cin >> t;
        if(t[0]=='+'){
            string q = st.top();st.pop();
            string p = st.top();st.pop();
            vector<bool> v(256,false);
            for (int j = 0; j < 256; j++) {
                if(!val[p][j]) continue;
                for (int k = 0; k < 256; k++) {
                    if(!val[q][k]) continue;
                    v[(j+k)%256] = true;
                }
            }
            val[p] = v;
            st.push(p);
        }
        else if(t[0]=='-'){
            string q = st.top();st.pop();
            string p = st.top();st.pop();
            vector<bool> v(256,false);
            for (int j = 0; j < 256; j++) {
                if(!val[p][j]) continue;
                for (int k = 0; k < 256; k++) {
                    if(!val[q][k]) continue;
                    v[(j-k+256)%256] = true;
                }
            }
            val[p] = v;
            st.push(p);
        }
        else if(t[0]=='*'){
            string q = st.top();st.pop();
            string p = st.top();st.pop();
            vector<bool> v(256,false);
            for (int j = 0; j < 256; j++) {
                if(!val[p][j]) continue;
                for (int k = 0; k < 256; k++) {
                    if(!val[q][k]) continue;
                    v[(j*k)%256] = true;
                }
            }
            val[p] = v;
            st.push(p);
        }
        else if(t[0]=='/'){
            string q = st.top();st.pop();
            string p = st.top();st.pop();
            vector<bool> v(256,false);
            for (int j = 0; j < 256; j++) {
                if(!val[p][j]) continue;
                for (int k = 0; k < 256; k++) {
                    if(!val[q][k]) continue;
                    if(k==0){
                        puts("error");
                        return 0;
                    }
                    v[j/k] = true;
                }
            }
            val[p] = v;
            st.push(p);
        }
        else{
            if(0<=t[0]-'0'&&t[0]-'0'<10){
                vector<bool> v(256,false);
                v[stoi(t)] = true;
                t += to_string(c[t[0] - '0']++);
                val[t] = v;
            }
            st.push(t);
        }
    }
    puts("correct");
    return 0;
}



Measured memory_bytes: 3320