#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	map<string, int>l;
	map<string, int>r;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		cin >> L >> R;
		l[s] = L;
		r[s] = R;
	}
	cin >> N;
	stack<bitset<256>>st;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		//cout << i << endl;
		//if (!st.empty())cout << st.top().to_string() << endl;
		if (s[0] == '+') {
			auto b = st.top();
			st.pop();
			auto a = st.top();
			st.pop();
			bitset<256>ret;
			for (int j = 0; j < 256; j++) {
				for (int k = 0; k < 256; k++) {
					if (a.test(j) && b.test(k)) {
						ret.set((j + k) % 256);
					}
				}
			}
			st.push(ret);
		}
		else if (s[0] == '-') {
			auto b = st.top();
			st.pop();
			auto a = st.top();
			st.pop();
			bitset<256>ret;
			for (int j = 0; j < 256; j++) {
				for (int k = 0; k < 256; k++) {
					if (a.test(j) && b.test(k)) {
						ret.set((j - k + 256) % 256);
					}
				}
			}
			st.push(ret);
		}
		else if (s[0] == '*') {
			auto b = st.top();
			st.pop();
			auto a = st.top();
			st.pop();
			bitset<256>ret;
			for (int j = 0; j < 256; j++) {
				for (int k = 0; k < 256; k++) {
					if (a.test(j) && b.test(k)) {
						ret.set((j * k) % 256);
					}
				}
			}
			st.push(ret);
		}
		else if(s[0]=='/'){
			auto b = st.top();
			st.pop();
			auto a = st.top();
			st.pop();
			bitset<256>ret;
			if (b.test(0)) {
				cout << "error" << endl;
				return 0;
			}
			for (int j = 0; j < 256; j++) {
				for (int k = 0; k < 256; k++) {
					if (a.test(j) && b.test(k)) {
						ret.set((j / k) % 256);
					}
				}
			}
			st.push(ret);
		}
		else if (s[0] <= '9'&&s[0] >= '0') {
			int num = stoi(s);
			bitset<256>ret;
			ret.set(num);
			st.push(ret);
		}
		else {
			bitset<256>ret;
			for (int i = l[s]; i <= r[s]; i++) {
				ret.set(i);
			}
			st.push(ret);
		}
	}
	cout << "correct" << endl;
}
