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

using Pi = pair < int, int >;

int main()
{
        int m;
        map < string , bitset < 256 > > variable;
        string op = "+-*/";

        cin >> m;
        for ( int i = 0; i < m; i++ ) {
                string name;
                int l, r;
                cin >> name >> l >> r;
                for ( int i = l; i <= r; i++ ) {
                        variable[name][i] = true;
                }
        }

        int n;
        stack < bitset <256> > dat;     
        cin >> n;
        for ( int i = 0; i < n; i++ ) {
                string q;
                cin >> q;
                if ( op.find(q) != string::npos ) {
                        bitset <256>b = dat.top(); dat.pop();
                        bitset <256>a = dat.top(); dat.pop();
                        bitset <256>c = 0;
                        if ( q == "+" ) {
                                for ( int j = 0; j < 256; j++ ) {
                                        for ( int k = 0; k < 256; k++ ) {
                                                int idx = (j + k) % 256;
                                                c[idx] = (c[idx] | a[j] & b[k]);
                                        }
                                }
                        } else if ( q == "-" ) {
                                for ( int j = 0; j < 256; j++ ) {
                                        for ( int k = 0; k < 256; k++ ) {
                                                int idx = (j - k + 256) % 256;
                                                c[idx] = (c[idx] | a[j] & b[k]);
                                        }
                                }
                        } else if ( q == "*" ) {
                                for ( int j = 0; j < 256; j++ ) {
                                        for ( int k = 0; k < 256; k++ ) {
                                                int idx = (j * k) % 256;
                                                c[idx] = (c[idx] | a[j] & b[k]);
                                        }
                                }
                        } else if ( q == "/" ) {
                                if ( b[0] == true ) {
                                        cout << "error" << endl;
                                        return ( 0 );
                                }
                                for ( int j = 0; j < 256; j++ ) {
                                        for ( int k = 1; k < 256; k++ ) {
                                                int idx = (j / k) % 256;
                                                c[idx] = (c[idx] | a[j] & b[k]);
                                        }
                                }
                        }
                        //cout << c << endl;
                        dat.push(c);
                } else {
                        if ( isdigit(q[0]) ) {
                                int value = stoi(q);
                                //cout << value << endl;
                                bitset < 256 > d;
                                d[value] = true;
                                dat.push(d);
                        } else {
                                dat.push(variable[q]);
                                //cout << variable[q] << endl;
                        }
                }
        }       
        
        cout << "correct" << endl;

        return ( 0 );
}



Measured memory_bytes: 3212