#include<bits/stdc++.h>
using namespace std;string S[9999],U;int n,a,b,c,d,p[9999][2],i,j;int main(){while(1){cin>>a>>b;if(!a){break;}for(i=0;i<a;i++){cin>>U>>c>>d;S[i]=U;p[i][0]=d-c+1;p[i][1]=d;}for(i=0;i<b;i++){cin>>c;for(j=0;j<a;j++){if(c>=p[j][0]&&c<=p[j][1]){cout<<S[j]<<' '<<c-p[j][0]+1<<endl;goto E;}}printf("Unknown\n");E:;}}}