#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<map>

using namespace std;

const double tolerance = 0.001;

#define fin cin

int main() {
//	fstream fin("ballot.in");
	map<string, double> party;
	int p, g;
	fin >> p >> g;
	for(int i = 0; i < p; i++) {
		string pa; double percentage;
		fin >> pa >> percentage >> ws;
		party[pa] = percentage;
	}
	for(int i = 1; i <= g; i++) {
		string line;
		getline(fin, line);
		stringstream sin(line);
		double sum = 0.0;
		string s = "+";
		while(s=="+") {
			sin >> s;
			sum += party[s];
			sin >> s;
		}
		double val;
		sin >> val;
		double mintol = val-tolerance;
		double maxtol = val+tolerance;
		bool ok = false;
		if(s == "=") {
			ok = mintol<sum && sum<maxtol;
		}
		if(s == "<") {
			ok = sum<mintol;
		}
		if(s == ">") {
			ok = sum>maxtol;
		}
		if(s == "<=") {
			ok = sum<maxtol;
		}
		if(s == ">=") {
			ok = mintol<sum;
		}
		cout << "Guess #" << i << " was " << (ok?"":"in") << "correct." << endl;
	}
	return 0;
}
