#include <iostream>
#include <stack>
#include <string>
#include <map>
#include <vector>
#include <sstream>
#include <cstdlib>

using namespace std;

typedef vector<bool> V;

V r2v(int lb, int ub) {
    V v(256, false);
    for (int x=lb; x<=ub; x++) {
        v[x] = true;
    }
    return v;
}

V s2v(string e) {
    int x = atoi(e.c_str());
    return r2v(x, x);
}

bool isnum(string e) {
    if (e.find_first_not_of("1234567890") != string::npos) {
        return false;
    }
    return true;
}

V plus_(pair<V, V> operand) {
    V res = V(256, false);
    V v1 = operand.first;
    V v2 = operand.second;
    for (int x1=0; x1<256; x1++) {
        if (!v1[x1]) {
            continue;
        }
        for (int x2=0; x2<256; x2++) {
            if (v2[x2]) {
                int y = (x1+x2)%256;
                res[y] = true;
            }
        }
    }
    return res;
}

V minus_(pair<V, V> operand) {
    V res = V(256, false);
    V v1 = operand.first;
    V v2 = operand.second;
    for (int x1=0; x1<256; x1++) {
        if (!v1[x1]) {
            continue;
        }
        for (int x2=0; x2<256; x2++) {
            if (v2[x2]) {
                int y = (x1-x2+256)%256;
                res[y] = true;
            }
        }
    }
    return res;
}

V multiply_(pair<V, V> operand) {
    V res = V(256, false);
    V v1 = operand.first;
    V v2 = operand.second;
    for (int x1=0; x1<256; x1++) {
        if (!v1[x1]) {
            continue;
        }
        for (int x2=0; x2<256; x2++) {
            if (v2[x2]) {
                int y = (x1*x2)%256;
                res[y] = true;
            }
        }
    }
    return res;
}

V divide_(pair<V, V> operand) {
    V res = V(256, false);
    V v1 = operand.first;
    V v2 = operand.second;
    if (v2[0]) {
        return V();
    }
    for (int x1=0; x1<256; x1++) {
        if (!v1[x1]) {
            continue;
        }
        for (int x2=0; x2<256; x2++) {
            if (v2[x2]) {
                int y = (x1/x2)%256;
                res[y] = true;
            }
        }
    }
    return res;
}

pair<V, V> pull(stack<V> &memory) {
    V v1, v2;

    v2 = memory.top();
    memory.pop();
    v1 = memory.top();
    memory.pop();

    return pair<V, V>(v1, v2);
}

int main() {
    int m, lb, ub, n;
    string name, e;
    map<string, V> variable;
    stack<V> memory;
    bool is_valid = true;

    cin >> m;
    for (int i=0; i<m; i++) {
        cin >> name >> lb >> ub;
        variable[name] = r2v(lb, ub);
    }
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> e;
        if (isnum(e)) {
            V v = s2v(e);
            memory.push(v);
        }
        else if (e == "+") {
            memory.push(plus_(pull(memory)));
        }
        else if (e == "-") {
            memory.push(minus_(pull(memory)));
        }
        else if (e == "*") {
            memory.push(multiply_(pull(memory)));
        }
        else if (e == "/") {
            memory.push(divide_(pull(memory)));
            if (memory.top().size() == 0) {
                is_valid = false;
                break;
            }
        }
        else {
            memory.push(variable[e]);
            variable.erase(e);
        }
    }
    if (is_valid) {
        cout << "correct" << endl;
    }
    else {
        cout << "error" << endl;
    }

    return 0;
}

Measured memory_bytes: 1272