#include "bits/stdc++.h"
using namespace std;
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2435&lang=jp
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	int m; cin >> m;
	string op = "+-/*";
	map<string, int> name_idx;
	vector<pair<int, int>> name(m + 1);
	for (int i = 1; i <= m; i++) {
		string _name; int lb, ub;
		cin >> _name >> lb >> ub;
		name_idx[_name] = i;
		name[i].first = lb; name[i].second = ub;
	}
	int n; cin >> n;
	stack<int> st_idx;
	vector<vector<int>> st(n, vector<int>(256, 0));
	for (int i = 0; i < n;i++) {
		string e; cin >> e;
		/* +-/* or value */
		if (name_idx[e] == 0) {
			if (e == "+") {
				int b_idx = st_idx.top(); st_idx.pop();
				int a_idx = st_idx.top(); st_idx.pop();
				for (int a = 0; a < 256;a++) {
					if (st[a_idx][a] == 0) continue;
					for (int b = 0; b < 256; b++) {
						if (st[b_idx][b] == 0) continue;
						st[i][(a + b) % 256] = 1;
					}
				}
			}
			else if (e == "-") {
				int b_idx = st_idx.top(); st_idx.pop();
				int a_idx = st_idx.top(); st_idx.pop();
				for (int a = 0; a < 256;a++) {
					if (st[a_idx][a] == 0) continue;
					for (int b = 0; b < 256; b++) {
						if (st[b_idx][b] == 0) continue;
						st[i][(a - b + 256) % 256] = 1;
					}
				}
			}
			else if (e == "*") {
				int b_idx = st_idx.top(); st_idx.pop();
				int a_idx = st_idx.top(); st_idx.pop();
				for (int a = 0; a < 256;a++) {
					if (st[a_idx][a] == 0) continue;
					for (int b = 0; b < 256; b++) {
						if (st[b_idx][b] == 0) continue;
						st[i][(a*b) % 256] = 1;
					}
				}
			}
			else if (e == "/") {
				int b_idx = st_idx.top(); st_idx.pop();
				int a_idx = st_idx.top(); st_idx.pop();
				for (int a = 0; a < 256;a++) {
					if (st[a_idx][a] == 0) continue;
					for (int b = 0; b < 256; b++) {
						if (st[b_idx][b] == 0) continue;
						if (b == 0) {
							cout << "error" << endl;
							return 0;
						}
						else {
							st[i][(a / b) % 256] = 1;
						}
					}
				}
			}
			else {
				st[i][atoi(e.c_str())] = 1;
			}
		}
		else {
			auto pii = name[name_idx[e]];
			for (int v = pii.first; v <= pii.second;v++) {
				st[i][v] = 1;
			}
		}
		st_idx.push(i);
	}
	cout << "correct" << endl;
	return 0;
}