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

struct Era{
	string name;
	int start; //0
	int end;
};

int main(){
	while(1){
		int n,q;
		cin >> n >> q;
		if(n==0) break;
		
		vector<Era> data(n);
		for(int i=0; i<n; i++){
			int eby;
			cin >> data[i].name >> eby >> data[i].end;
			data[i].start = data[i].end-eby;
		}
		
		for(int i=0; i<q; i++){
			bool found = false;
			int year;
			cin >> year;
			for(int j=0; j<n; j++){
				if(data[j].start<year && year<=data[j].end){
					cout << data[j].name << " " << year-data[j].start << endl;
					found = true;
					break;
				}
			}
			if(!found){
				cout << "Unknown" << endl;
			}
		}
	}
	return 0;
}