// Author: Walter Guttmann
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>

using namespace std;

//ifstream in("ballot.in");

#define in cin

int main() {
  int p, g;
  while (in >> p >> g) {
    map<string,int> vote;
    string s, op;
    for (int i=0 ; i<p ; i++) {
      double d;
      in >> s >> d;
      int e = (int) floor(d*10 + 0.5);
      vote[s] = e;
    }
    for (int i=1 ; i<=g ; i++) {
      int e = 0;
      while (in >> s) {
        e += vote[s];
        in >> op;
        if (op != "+") break;
      }
      int f;
      in >> f;
      f *= 10;
      bool guess = (op=="<" && e<f) || (op==">" && e>f) || (op=="<=" && e<=f) || (op==">=" && e>=f) || (op=="=" && e==f);
      cout << "Guess #" << i << " was " << (guess ? "correct" : "incorrect") << "." << endl;
    }
  }
  return 0;
}

