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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<unsigned char, unsigned char> P;
typedef vector<unsigned char> nv;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

bool calc_form(string op,nv a,nv b,nv& res){
  if(op=="/"){
    rep(i,b.size()){
      if(b[i]==0)return false;
    }
  }
  rep(i,a.size())rep(j,b.size()){
    unsigned char add;
    if(op=="+"){
      add=a[i]+b[j];
    }else if(op=="-"){
      add=a[i]-b[j];
    }else if(op=="*"){
      add=a[i]*b[j];
    }else{
      add=a[i]/b[j];
    }
    res.push_back(add);
  }
  sort(all(res));
  uni(res);
  return true;
}

int n,m;
map<string,P> h;
stack<nv> st;
vector<string> form;

int main(){
	cin.sync_with_stdio(false);
  cin>>m;
  rep(i,m){
    string name; int a,b;
    cin>>name>>a>>b;
    h[name]=P(a,b);
  }
  cin>>n;
  rep(i,n){
    string a;
    cin>>a;
    form.push_back(a);
  }
  rep(i,n){
    string a=form[i];
    if(a=="+"||a=="-"||a=="*"||a=="/"){
      nv n2=st.top(); st.pop();
      nv n1=st.top(); st.pop();
      nv tmp;
      if(!calc_form(a,n1,n2,tmp)){
        cout<<"error"<<endl;
        return 0;
      }
      st.push(tmp);
    }else if(h.count(a)){
      nv tmp;
      repl(i,h[a].fi,h[a].se+1){
        tmp.push_back(i);
      }
      st.push(tmp);
    }else{
      nv tmp;
      tmp.push_back(stoi(a));
      st.push(tmp);
    }
  }
  cout<<"correct"<<endl;
	return 0;
}