#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int m, n;
map<string, pii> mp;
string e[110];
int dp[110][110][256];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> m;
  for (int i = 0; i < m; i++) {
    string name;
    int lb, ub;
    cin >> name >> lb >> ub;
    mp[name] = pii(lb, ub);
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> e[i];
  }

  stack<pii> st;
  for (int i = 0; i < n; i++) {
    if (isdigit(e[i][0])) {
      dp[i][i][stoi(e[i])] = 1;
      st.emplace(i, i);
    } else if (isalpha(e[i][0])) {
      pii r = mp[e[i]];
      for (int j = 0; j < 256; j++) {
        dp[i][i][j] = (r.first <= j && j <= r.second);
      }
      st.emplace(i, i);
    } else {
      if (st.size() < 2) {
        cout << "error" << endl;
        return 0;
      }
      pii a, b;
      b = st.top(); st.pop();
      a = st.top(); st.pop();
      if (e[i] == "+") {
        for (int j = 0; j < 256; j++) {
          for (int k = 0; k < 256; k++) {
            dp[a.first][i][(j+k)%256] |= (dp[a.first][a.second][j] && dp[b.first][b.second][k]);
          }
        }
      } else if (e[i] == "-") {
        for (int j = 0; j < 256; j++) {
          for (int k = 0; k < 256; k++) {
            dp[a.first][i][(j-k+256)%256] |= (dp[a.first][a.second][j] && dp[b.first][b.second][k]);
          }
        }
      } else if (e[i] == "*") {
        for (int j = 0; j < 256; j++) {
          for (int k = 0; k < 256; k++) {
            dp[a.first][i][(j*k)%256] |= (dp[a.first][a.second][j] && dp[b.first][b.second][k]);
          }
        }
      } else if (e[i] == "/") {
        if (dp[b.first][b.second][0]) {
          cout << "error" << endl;
          return 0;
        }
        for (int j = 0; j < 256; j++) {
          for (int k = 1; k < 256; k++) {
            dp[a.first][i][(j/k)%256] |= (dp[a.first][a.second][j] && dp[b.first][b.second][k]);
          }
        }
      }
      st.emplace(a.first, i);
    }
  }
  cout << "correct" << endl;

  return 0;
}
