#include <iostream>
#include <map>
#include <vector>
#include <stack>
#include <string>
using namespace std;

bool is_valiable(string e){
  for(int i = 0; i < (int)e.length(); ++i){
    if(e[i] < '0' || e[i] > '9') return true;
  }
  return false;
}

int main(){
  int m, mod = 256;
  cin >> m;
  string name;
  int lb, ub;
  map<string, vector<int> > M;
  for(int i = 0; i < m; ++i){
    cin >> name >> lb >> ub;
    vector<int> t(mod,0);
    for(int j = lb; j <= ub; ++j){
      t[j] = 1;
    }
    M[name] = t;
  }
  
  int n;
  cin >> n;
  string e, o = "+-*/";
  stack<string> st;
  for(int i = 0; i < n; ++i){
    cin >> e;
    if(o.find(e) < 4){
      string b = st.top();st.pop();
      string a = st.top();st.pop();
      //cout << a << " " << b << endl;
      if(e == "+"){
	if(is_valiable(a)){
	  if(is_valiable(b)){
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      for(int k = 0; k < mod; ++k){
		if(M[a][j] && M[b][k]){
		  //st.push(to_string((j+k)%mod));
		  t[(j+k)%mod] = 1;
		}
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }else{
	    int B = stoi(b)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[a][j]){
		t[(j+B)%mod] = 1;
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }
	}else{
	  if(is_valiable(b)){
	    int A = stoi(a)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[b][j]){
		t[(A+j)%mod] = 1;
	      }
	    }
	    M[b] = t;
	    st.push(b);
	  }else{
	    st.push(to_string((stoi(a)%mod+stoi(b)%mod)%mod));
	  }
	}
      }else if(e == "-"){
	if(is_valiable(a)){
	  if(is_valiable(b)){
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      for(int k = 0; k < mod; ++k){
		if(M[a][j] && M[b][k]){
		  t[(j-k+mod)%mod] = 1;
		}
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }else{
	    int B = stoi(b)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[a][j]){
		t[(j-B+mod)%mod] = 1;
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }
	}else{
	  if(is_valiable(b)){
	    int A = stoi(a)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[b][j]){
		t[(A-j+mod)%mod] = 1;
	      }
	    }
	    M[b] = t;
	    st.push(b);
	  }else{
	    st.push(to_string((stoi(a)%mod-stoi(b)%mod+mod)%mod));
	  }
	}
      }else if(e == "*"){
	if(is_valiable(a)){
	  if(is_valiable(b)){
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      for(int k = 0; k < mod; ++k){
		if(M[a][j] && M[b][k]){
		  t[(j*k)%mod] = 1;
		}
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }else{
	    int B = stoi(b)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[a][j]){
		t[(j*B)%mod] = 1;
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }
	}else{
	  if(is_valiable(b)){
	    int A = stoi(a)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[b][j]){
		t[(A*j)%mod] = 1;
	      }
	    }
	    M[b] = t;
	    st.push(b);
	  }else{
	    st.push(to_string(((stoi(a)%mod)*(stoi(b)%mod))%mod));
	  }
	}
      }else if(e == "/"){
	if(is_valiable(a)){
	  if(is_valiable(b)){
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      for(int k = 0; k < mod; ++k){
		if(M[a][j] && M[b][k]){
		  if(k == 0){
		    cout << "error" << endl;
		    return 0;
		  }
		  t[((j%mod)/(k%mod))%mod] = 1;
		}
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }else{
	    if(b == "0"){
	      cout << "error" << endl;
	      return 0;
	    }
	    int B = stoi(b)%mod;
	    vector<int> t(mod,0);
   	    for(int j = 0; j < mod; ++j){
	      if(M[a][j]){
		t[(j/B)%mod] = 1;
	      }
	    }
	    M[a] = t;
	    st.push(a);
	  }
	}else{
	  if(is_valiable(b)){
	    int A = stoi(a)%mod;
	    vector<int> t(mod,0);
	    for(int j = 0; j < mod; ++j){
	      if(M[b][j]){
		if(j == 0){
		  cout << "error" << endl;
		  return 0;
		}
		t[(A/j)%mod] = 1;
	      }
	    }
	    M[b] = t;
	    st.push(b);
	  }else{
	    if(b == "0"){
	      cout << "error" << endl;
	      return 0;
	    }
	    st.push(to_string((stoi(a)/stoi(b))%mod));
	  }
	}
      }
    }else{
      st.push(e);
    }
  }
  cout << "correct" << endl;
  return 0;
}

Measured memory_bytes: 3328