#include <iostream>
#include <cctype>
#include <string>
#include <vector>
#include <stack>
#include <map>
using namespace std;
map<string, vector<bool>> mp;
int main() {
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string name;
		int l, u;
		cin >> name >> l >> u;
		vector<bool> v;
		for (int i = 0; i <= 255; i++) {
			v.push_back(l <= i && i <= u);
		}
		mp[name] = v;
	}
	int n;
	cin >> n;
	stack<vector<bool>> s;
	for (int i = 0; i < n; i++) {
		string e;
		cin >> e;
		if (mp.find(e) != mp.end()) {
			s.push(mp[e]);
		}
		else if(isdigit(e[0])) {
			int val = 0;
			for (int j = 0; j < e.size(); j++) {
				val *= 10;
				val += e[j] - '0';
			}
			vector<bool> v;
			for (int j = 0; j <= 255; j++) {
				v.push_back(j == val);
			}
			s.push(v);
		}
		else {
			vector<bool> op1, op2, res;
			op2 = s.top(); s.pop();
			op1 = s.top(); s.pop();
			for (int j = 0; j <= 255; j++) res.push_back(0);
			for (int j = 0; j <= 255; j++) {
				if (!op1[j]) continue;
				for (int k = 0; k <= 255; k++) {
					if (!op2[k]) continue;
					if (e[0] == '+') {
						res[(j + k) % 256] = 1;
					}
					else if (e[0] == '-') {
						res[(j - k + 256) % 256] = 1;
					}
					else if (e[0] == '*') {
						res[j*k % 256] = 1;
					}
					else {
						if (k == 0) {
							cout << "error" << endl;
							return 0;
						}
						res[j / k] = 1;
					}
				}
			}
			s.push(res);
		}
	}
	cout << "correct" << endl;
}
