//Era Name
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef struct ERA{
  string name;
  ll l, f;
}era;

era mk(string s, ll l, ll f){
  era ret;
  ret.name=s;
  ret.l=l;
  ret.f=f;
  return ret;
}

int main(){
  ll N, Q;
  while(cin>>N>>Q, !(N==0&&Q==0)){
    vector<era> v;
    for(ll i=0; i<N; i++){
      string s;
      ll l, f;
      cin>>s>>l>>f;
      v.push_back(mk(s, l, f));
    }
    for(ll i=0; i<Q; i++){
      ll q;
      cin>>q;
      bool flag=false;
      for(int j=0; j<v.size(); j++){
	if((v[j].f-v[j].l)<q && q<=v[j].f){
	  cout<<v[j].name<<" "<<v[j].l-(v[j].f-q)<<endl;
	  flag=true;
	break;
	}
      }
      if(!flag)cout<<"Unknown"<<endl;
    }
  }
  return 0;
}