#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

string s[1010];
int start[1010],l[1010];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,m; cin >> n >> m;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin >> s[i] >> l[i] >> start[i];
			start[i]-=l[i]-1;
		}
		while(m--){
			int t; cin >> t;
			bool f=0;
			for(int i=0;i<n;i++){
				if(start[i]<=t&&t<start[i]+l[i]){
					cout << s[i] << " " << (t-start[i]+1) << endl;
					f=1;
					break;
				}
			}
			if(!f)cout << "Unknown" << endl;
		}
	}
}
