// AOJ 0029 English Sentence
// ??????0??????????£? 5???
// map????????£?????°???????????????????????§???????????????????????¬??????????????????????¢?????????????
#include <iostream>
#include <map>
#include <string>
using namespace std;
int N,Q;
string era[10010];
int eby[10010],wy[10010];
int solve(){
	cin >> N >> Q;
	if(N+Q==0)return 1;
	for(int i=0;i<N;i++){
		cin >> era[i] >> eby[i] >> wy[i];
	}
	for(int i=0;i<Q;i++){
		int tar;
		cin >> tar;
		bool known = false;
		for(int j=0;j<N;j++){
			if(wy[j]-eby[j]<tar&&tar<=wy[j]){
				cout << era[j] << ' ' << tar-(wy[j]-eby[j]) << endl;
				known = true;
				break;
			}
		}
		if(!known)cout << "Unknown" << endl;
	}
	return 0;
}
int main(){
	while(!solve()){}
	return 0;
}