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

const int MAXN = 101;
int m, n;
map<string, int> lb, ub;
string e[MAXN];

int main() {
  while(cin >> m) {
    lb.clear(); ub.clear();
    for(int i = 0; i < m; ++i) {
      string name; cin >> name;
      cin >> lb[name] >> ub[name];
    }
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> e[i];
    try {
      stack<vector<int> > stk;
      for(int i = 0; i < n; ++i) {
        const string &s = e[i];
        if(isdigit(s[0])) {
          vector<int> v(256);
          v[atoi(s.c_str())] = 1;
          stk.push(v);
        } else if(isalpha(s[0])) {
          vector<int> v(256);
          for(int i = lb[s]; i <= ub[s]; ++i) v[i] = 1;
          stk.push(v);
        } else {
          vector<int> a, b, v(256);
          b = stk.top(); stk.pop();
          a = stk.top(); stk.pop();
          for(int i = 0; i < a.size(); ++i) {
            if(!a[i]) continue;
            for(int j = 0; j < b.size(); ++j) {
              if(!b[j]) continue;
              if(s[0] == '+') {
                v[(i+j)%256] = 1;
              } else if(s[0] == '-') {
                v[(i-j+256)%256] = 1;
              } else if(s[0] == '*') {
                v[i*j%256] = 1;
              } else if(s[0] == '/') {
                if(j == 0) throw 0;
                v[i/j] = 1;
              }
            }
          }
          stk.push(v);
        }
      }
      cout << "correct" << endl;
    } catch(...) {
      cout << "error" << endl;
    }
  }
  return 0;
}