// Author: Adrian Kuegel
// Algorithm: straightforward
// Date: June 16th, 2009

#include <stdio.h>
#include <map>
#include <string>
#include <cstring>
#include <assert.h>
using namespace std;

int main() {
	int p, g, pa, pb;
	char op[10], name[100];
//	freopen("ballot.in", "r", stdin);
	assert( scanf("%d %d", &p, &g) == 2);
	assert(p > 0 && p <= 50 && g > 0 && g <= 10000);
	map<string, int> pvals;
	for (int i=0; i<p; ++i) {
		assert( scanf("%s %d.%d", name, &pa, &pb) == 3);
		assert(pvals.find(name) == pvals.end());
		pvals[name] = pa * 10 + pb;
	}
	for (int gn=1; gn<=g; ++gn) {
		int sum = 0;
		op[1] = 0;
		do {
			assert(op[1] == 0);
			assert( scanf("%s %s", name, op) == 2 );
			assert(pvals.find(name) != pvals.end());
			sum += pvals[name];
		}while(op[0] == '+');
		int cval;
		assert( scanf("%d", &cval) == 1 );
		bool correct;
		if (!strcmp(op, "<"))
			correct = (sum < cval * 10);
		else if (!strcmp(op, "<="))
			correct = (sum <= cval * 10);
		else if (!strcmp(op, ">="))
			correct = (sum >= cval * 10);
		else if (!strcmp(op, ">"))
			correct = (sum > cval * 10);
		else {
			assert(!strcmp(op, "="));
			correct = (sum == cval * 10);
		}
		printf("Guess #%d was %s.\n", gn, correct? "correct" : "incorrect");
	}
	return 0;
}
