#include <iostream>
#include <string>
using namespace std;
int main(){
	int n,q;
	while(cin>>n>>q){
		if(n==0&&q==0) break;
		string g[n];
		int a[n][2],b;
		for(int i=0;i<n;i++){
			cin>>g[i]>>a[i][0]>>a[i][1];
			a[i][0]=a[i][1]-a[i][0]+1;
		}
		for(int i=0;i<q;i++){
			cin>>b;
			for(int t=0;t<n;t++){
				if(b>=a[t][0]&&b<=a[t][1]){
					cout<<g[t]<<" "<<b-a[t][0]+1<<endl;
					goto end;
				}
			}
			cout<<"Unknown"<<endl;
			end:;
		}
	}
    return 0;
}