#include <cstdio>
#include <cassert>
#include <cctype>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <stdexcept>

std::set<int> apply(
    const std::set<int> &lhs, const std::set<int> &rhs, char op) {

  std::set<int> res;
  for (int lx: lhs)
    for (int rx: rhs) {
      if (op == '+') {
        res.insert((lx+rx)&255);
      } else if (op == '-') {
        res.insert((lx-rx)&255);
      } else if (op == '*') {
        res.insert((lx*rx)&255);
      } else if (op == '/') {
        if (rx == 0) throw std::logic_error("division by zero");
        res.insert(lx/rx);
      }
    }

  return res;
}

int main() {
  size_t m;
  scanf("%zu", &m);

  std::map<std::string, std::set<int>> vars;
  for (size_t i=0; i<m; ++i) {
    char buf[32];
    int lb, ub;
    scanf("%s %d %d", buf, &lb, &ub);
    std::string s=buf;
    std::set<int> tmp;
    for (int i=lb; i<=ub; ++i)
      tmp.insert(i);

    vars[s] = std::move(tmp);
  }

  size_t n;
  scanf("%zu", &n);
  std::stack<std::set<int>> st;
  for (size_t i=0; i<n; ++i) {
    char buf[32];
    scanf("%s", buf);
    std::string s=buf;
    if (isdigit(s[0])) {
      st.push({stoi(s)});
    } else if (isalpha(s[0])) {
      st.push(vars.at(s));
    } else {
      std::set<int> b=st.top();
      st.pop();
      std::set<int> a=st.top();
      st.pop();
      try {
        st.push(apply(a, b, s[0]));
      } catch (std::logic_error &e) {
        printf("error\n");
        return 0;
      }
    }
  }
  printf("correct\n");
}

