#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,q,year;
  int y[1000],b[1000];
  string s,era[1000];
  while(1){
    cin>>n>>q;
    if(n==0 && q==0) break;
    for(int i=0;i<n;i++){
      cin>>era[i]>>b[i]>>y[i];
    }
    for(int i=0;i<q;i++){
      cin>>year;
      for(int j=0;j<n;j++){
	if(year<=y[j] && year>y[j]-b[j]){
	  cout<<era[j]<<" "<<year-y[j]+b[j]<<endl;
	  break;
	}
	else if(j==n-1) cout<<"Unknown"<<endl;
      }
    }
  }
  return 0;
}

