#include<iostream>
#include<string>
using namespace std;

int main()
{
	int N, Q;
	while (cin >> N >> Q && N != 0 || Q != 0)
	{
		string names[1000];
		long eraBased[1000];
		long yearStart[1000];
		long western[1000];

		for (int i = 0; i < N; i++)
		{
			cin >> names[i] >> eraBased[i] >> western[i];
			yearStart[i] = western[i] - eraBased[i];
		}

		for (int i = 0; i < Q; i++)
		{
			long year;
			cin >> year;
			string yearName = "";
			int diff = -1;
			for (int j = 0; j < N; j++)
			{
				if (yearStart[j] < year && western[j] >= year)
				{
					yearName = names[j];
					diff = (year - yearStart[j]);
					break;
				}
			}

			if (diff != -1)
			{
				cout << yearName << " " << diff << endl;
			}
			else
			{
				cout << "Unknown" << endl;
			}
		}
	}
	return 0;
}