#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int m, n;
  map<string, pair<int, int> > mp;
  vector<string> es;

  cin >> m;
  rep(i, m) {
    string name; int lb, ub;
    cin >> name >> lb >> ub;
    mp[name] = make_pair(lb, ub);
  }
  cin >> n;
  es.resize(n);
  rep(i, n) cin >> es[i];

  string ops = "+-*/";
  stack<int> stk;
  vector< unordered_set<int> > vec(n);

  rep(i, n) {
    string e = es[i];

    if(ops.find(e) == -1) {
      if(mp.count(e) == 0) vec[i].insert(stoi(e));
      else reps(j, mp[e].first, mp[e].second+1) vec[i].insert(j);
    } else {
      int bi = stk.top(); stk.pop();
      int ai = stk.top(); stk.pop();
      for(int a : vec[ai]) {
	for(int b : vec[bi]) {
	  int res;
	  if(e == "+") {
	    res = (a + b) % 256;
	  } else if(e == "-") {
	    res = (a - b + 256) % 256;
	  } else if(e == "*") {
	    res = (a * b) % 256;
	  } else if(e == "/") {
	    if(b == 0) {
	      puts("error");
	      return 0;
	    }
	    res = (a / b) % 256;
	  }
	  vec[i].insert(res);
	}
      }
    }
    stk.push(i);
  }

  puts("correct");

  return 0;
}