#include <iostream>
#include <string>
#include <queue>
#include <vector>

using namespace std;

typedef pair<int, int> P;
typedef pair<P, string> Q;

int main() {
	int n, q;
	while (cin >> n >> q) {
		if (n == 0 && q == 0) {
			break;
		}
		priority_queue<Q> pq;
		string era;
		int base;
		int west;
		for (int i = 0; i < n; i++) {
			cin >> era >> base >> west;
			Q p;
			(p.first).first = west-base+1;
			(p.first).second = west;
			p.second = era;
			pq.push(p);
		}
		vector<Q> hyou(n);
		for (int i = 0; i < n; i++) {
			hyou[i] = pq.top();
			pq.pop();
		}
		int a;
		for (int i = 0; i < q; i++) {
			cin >> a;
			bool hantei = true;
			for (int j = 0; j < n; j++) {
				if ((hyou[j].first).first <= a && a <= (hyou[j].first).second) {
					hantei = false;
					cout << hyou[j].second << ' ' << a-(hyou[j].first).first+1 << endl;
					break;
				}
			}
			if (hantei) {
				cout << "Unknown" << endl;
			}
		}
	}
	return 0;
}