// Author: Christoph Schwirzer
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <sstream>
#include <cctype>
using namespace std;
int main()
{
	//freopen("ballot.in", "r", stdin);
	int m, n;
	cin >> m >> n;
	map<string, int> result;
	for (int i=0; i<m; i++)
	{
		string party;
		double p;
		cin >> party >> p;
		result[party] = (int)round(10.0 * p);
	}
	for (int i=0; i<=n; i++)
	{
		string line;
		getline(cin, line);
		if (!i)
			continue;
		istringstream is(line);
		string tmp;
		int x = 0;
		while (is >> tmp)
		{
			if (tmp == "+")
				continue;
			if (!isalnum(tmp[0]))
				break;
			x += result[tmp];
		}
		double y;
		is >> y;
		int z = (int)round(10.0 * y);
		bool flag =
		 tmp == "=" && x == z ||
		 tmp == ">" && x > z ||
		 tmp == "<" && x < z ||
		 tmp == ">=" && x >= z ||
		 tmp == "<=" && x <= z;
		cout << "Guess #" << i << " was " << (flag ? "" : "in") << "correct." << endl;
	}
	return 0;
}
