#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
int main()
{
    map<string, vector<bool>> mp;
    int m;
    cin >> m;
    rep(i, m)
    {
        string c;
        cin >> c;
        int a, b;
        cin >> a >> b;
        mp[c] = vector<bool>(256, false);
        rep(j, a, b + 1)
        {
            mp[c][j] = true;
        }
    }
    int n;
    cin >> n;
    vector<string> e(n);
    rep(i, n)
    {
        cin >> e[i];
    }
    vector<vector<bool>> st;
    for (auto &&token : e)
    {
        if (isdigit(token[0]))
        {
            int num = atoi(token.c_str());
            vector<bool> p(256, false);
            p[num] = true;
            st.push_back(p);
        }
        else
        {
            if (token == "+")
            {
                vector<bool> b = st.back();
                st.pop_back();
                vector<bool> a = st.back();
                st.pop_back();
                vector<bool> c(256, false);
                rep(i, 256)
                {
                    rep(j, 256)
                    {
                        if (a[i] && b[j])
                        {
                            c[(i + j) % 256] = true;
                        }
                    }
                }
                st.push_back(c);
            }
            else if (token == "-")
            {
                vector<bool> b = st.back();
                st.pop_back();
                vector<bool> a = st.back();
                st.pop_back();
                vector<bool> c(256, false);
                rep(i, 256)
                {
                    rep(j, 256)
                    {
                        if (a[i] && b[j])
                        {
                            c[(i - j + 256) % 256] = true;
                        }
                    }
                }
                st.push_back(c);
            }
            else if (token == "/")
            {
                vector<bool> b = st.back();
                st.pop_back();
                vector<bool> a = st.back();
                st.pop_back();
                vector<bool> c(256, false);

                rep(i, 256)
                {
                    rep(j, 256)
                    {
                        if (a[i] && b[j])
                        {
                            if (j == 0)
                            {
                                cout << "error" << endl;
                                return 0;
                            }
                            c[i / j] = true;
                        }
                    }
                }
                st.push_back(c);
            }
            else if (token == "*")
            {
                vector<bool> b = st.back();
                st.pop_back();
                vector<bool> a = st.back();
                st.pop_back();
                vector<bool> c(256, false);

                rep(i, 256)
                {
                    rep(j, 256)
                    {
                        if (a[i] && b[j])
                        {
                            c[(i * j) % 256] = true;
                        }
                    }
                }
                st.push_back(c);
            }
            else
            {
                st.push_back(mp[token]);
            }
        }
    }
    cout << "correct" << endl;
    return 0;
}



Measured memory_bytes: 3232