#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n, q;
	while (cin >> n >> q, n) {
		map<int, string>mp;
		map<string, int>m;
		rep(i, n) {
			string s;
			int j, k;
			cin >> s >> j >> k;
			mp[k - j + 1] = s;
			m[s] = j;
		}
		rep(i, q) {
			int d; cin >> d;
			bool flag = false;
			for (auto p : mp) {
				if (0 <= d - p.first&&d - p.first < m[p.second]) {
					flag = true;
					cout << p.second << ' ' << d - p.first + 1 << endl;
					break;
				}
			}
			if (!flag)puts("Unknown");
		}
	}
}