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

int n, q;
string era[1000]; int offset[1000]; int year[1000];

int main() {
	while (cin >> n >> q) {
		if (!n) break;
		int i, j;
		
		for (i = 0; i < n; i++) cin >> era[i] >> offset[i] >> year[i];
		for (i = 0; i < q; i++) {
			int y;
			vector<int> ansId;
			
			cin >> y;
			for (j = 0; j < n; j++) {
				int firstYear = year[j] - offset[j] + 1;
				if (firstYear <= y && y <= year[j]) {
					ansId.push_back(j);
				}
			}
			if (ansId.size() != 1) { cout << "Unknown" << endl; }
			else { cout << era[ansId[0]] << " " << offset[ansId[0]] - year[ansId[0]] + y << endl; }
		}
	}
	return 0;
}