#include <iostream>
#include <vector>
#include <string>
using namespace std;
struct item{
	string name;
	int year;
	int value;
};
int main(){
	int n,m,a,b;
	item x;
	string s;
	vector<item> v;
	bool check;
	while(1){
		cin >> n >> m;
		if(n == 0)break;
		v.clear();
		for(int i = 0;i < n;i++){
			cin >> s >> a >> b;
			x.name = s;
			x.year = b;
			x.value = a;
			v.push_back(x);
		}
		for(int i = 0;i < m;i++){
			check = false;
			cin >> a;
			for(int j = 0;j < v.size();j++){
				if(v[j].year >= a && v[j].year - v[j].value < a){
					cout << v[j].name << " " << a - (v[j].year - v[j].value) << endl;
					check = true;
				}
			}
			if(!check)cout << "Unknown" <<endl;
		}
	}
	return 0;
}