#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001
#define MOD 256

deque<string> q;
unordered_map<string, S> mp;
int nameLength = 21;

bool isDigit(string s) {
    return '0' <= s[0] && s[0] <= '9';
}

bool calc(int op) {
    string a, b;
    b = q.back(), q.pop_back();
    a = q.back(), q.pop_back();
    bool aa = isDigit(a), bb = isDigit(b);
    if (aa && bb) {
        if (op == 0) q.push_back(to_string((stoi(a) + stoi(b)) % MOD));
        else if (op == 1) q.push_back(to_string((stoi(a) - stoi(b) + MOD) % MOD));
        else if (op == 2) q.push_back(to_string((stoi(a) * stoi(b)) % MOD));
        else {
            if (stoi(b) != 0) q.push_back(to_string((stoi(a) / stoi(b)) % MOD));
            else return false;
        }
    } else if (!aa && !bb) {
        S c;
        if (op == 0) each(i, mp[a])each(j, mp[b]) c.insert((i + j) % MOD);
        else if (op == 1) each(i, mp[a])each(j, mp[b]) c.insert((i - j + MOD) % MOD);
        else if (op == 2) each(i, mp[a])each(j, mp[b]) c.insert((i * j) % MOD);
        else  each(i, mp[a])each(j, mp[b]) {
            if (j != 0) c.insert((i / j) % MOD);
            else return false;
        }
        string newStr(nameLength++, 'a');
        q.push_back(newStr);
        mp[newStr] = c;
    } else if (!aa) {
        S c;
        int d = stoi(b);
        if (op == 0) each(i, mp[a]) c.insert((i + d) % MOD);
        else if (op == 1) each(i, mp[a]) c.insert((i - d + MOD) % MOD);
        else if (op == 2) each(i, mp[a]) c.insert((i * d) % MOD);
        else each(i, mp[a]) {
            if (d != 0) c.insert((i / d) % MOD);
            else return false;
        }
        string newStr(nameLength++, 'a');
        q.push_back(newStr);
        mp[newStr] = c;
    } else {
        S c;
        int d = stoi(a);
        if (op == 0) each(i, mp[b]) c.insert((d + i) % MOD);
        else if (op == 1) each(i, mp[b]) c.insert((d - i + MOD) % MOD);
        else if (op == 2) each(i, mp[b]) c.insert((d * i) % MOD);
        else each(i, mp[b]) {
            if (i != 0) c.insert((d / i) % MOD);
            else return false;
        }
        string newStr(nameLength++, 'a');
        q.push_back(newStr);
        mp[newStr] = c;
    }
    return true;
}

bool decode(string s) {
    bool ret = true;
    if (s[0] == '+') {
        ret = calc(0);
    } else if (s[0] == '-') {
        ret = calc(1);
    } else if (s[0] == '*') {
        ret = calc(2);
    } else if (s[0] == '/') {
        ret = calc(3);
    } else {
        q.push_back(s);
    }
    return ret;
}

int main(){
    cin.sync_with_stdio(false);
    int n, m;
    cin >> m;
    rep(i, m) {
        string s;
        int l, u;
        cin >> s >> l >> u;
        S st;
        repl(j, l, u + 1) st.insert(j);
        mp[s] = st;
    }

    cin >> n;
    bool ok = true;
    rep(i, n) {
        string s;
        cin >> s;
        ok = decode(s);
        if (!ok) break;
    }

    if (ok) cout << "correct" << endl;
    else cout << "error" << endl;

    return 0;
}

Measured memory_bytes: 3588