#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
map<string, P> mp;
typedef bitset<256> bs;
int main(){
	bool zerodiv = false;
	int n, m; cin >> n;
	rep(i, n) {
		string s; int le, ri; cin >> s >> le >> ri;
		mp[s] = { le,ri };
	}
	stack<bitset<256>> q;
	cin >> m;
	rep(i, m) {
		string s; cin >> s;
		if (zerodiv)continue;
		bs b = 0;
		if ('0' <= s[0] && s[0] <= '9') {
			int u = stoi(s);
			b[u] = 1;
			q.push(b);
		}
		else if (s == "+") {
			bs c;
			c = q.top(); q.pop();
			b = q.top(); q.pop();
			bs nex = 0;
			rep(j, 256) {
				if (!b[j])continue;
				rep(k, 256) {
					if (!c[k])continue;
					nex[(j + k) % 256] = 1;
				}
			}
			q.push(nex);
		}
		else if (s == "-") {
			bs c;
			c = q.top(); q.pop();
			b = q.top(); q.pop();
			bs nex = 0;
			rep(j, 256) {
				if (!b[j])continue;
				rep(k, 256) {
					if (!c[k])continue;
					nex[(j - k+256) % 256] = 1;
				}
			}
			q.push(nex);
		}
		else if (s == "*") {
			bs c;
			c = q.top(); q.pop();
			b = q.top(); q.pop();
			bs nex = 0;
			rep(j, 256) {
				if (!b[j])continue;
				rep(k, 256) {
					if (!c[k])continue;
					nex[j*k % 256] = 1;
				}
			}
			q.push(nex);
		}
		else if (s == "/") {
			bs c;
			c = q.top(); q.pop();
			b = q.top(); q.pop();
			if (c[0]) {
				zerodiv = true; continue;
			}
			bs nex = 0;
			rep(j, 256) {
				if (!b[j])continue;
				rep(k, 256) {
					if (!c[k])continue;
					nex[j/k] = 1;
				}
			}
			q.push(nex);
		}
		else {
			Rep1(j, mp[s].first, mp[s].second) {
				b[j] = 1;
			}
			q.push(b);
		}
	}
	if (zerodiv)cout << "error" << endl;
	else cout << "correct" << endl;
	return 0;
}
