#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
#define P pair<int,int>
int main(){
	int n,m;
while(true){
	cin>>n>>m;
if(n==0&&m==0)break;
vector<pair<P,string> >ta;//西暦、基数、名前の順番で入れる
for(int i=0;i<n;i++){
int a,b;string c;
cin>>c>>a>>b;
ta.push_back(pair<P,string>(P(b,a),c));
}
sort(ta.begin(),ta.end());
for(int izc=0;izc<m;izc++){
int tmp;
cin>>tmp;
bool f=0;
for(int i=0;i<n;i++){
int a=ta[i].first.first,b=ta[i].first.second;
string c=ta[i].second;
if(b-(a-tmp)>=1&&b>=b-(a-tmp)){
cout<<c<<" "<<b-(a-tmp)<<endl;
f=1;
}

}
if(f==0)cout<<"Unknown"<<endl;
}//for
}//while
	return 0;
}