#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
int N,Q;
signed main(){
  while(cin >> N >> Q && (N!=0 || Q!=0)){
    map<int,string> start;
    map<string,int> finish;
    rep(i,N){
      string Eraname;
      int Erabaseyear,Westernyear;
      cin >> Eraname >> Erabaseyear >> Westernyear;
      start[Westernyear-(Erabaseyear-1)]=Eraname;
      finish[Eraname]=Westernyear;
    }
    rep(i,Q){
      int q,label=0;
      cin >> q;
      for(auto p=start.begin();p!=start.end();p++){
        if(p->first<=q){
          string e=start[p->first];
          if(finish[e]>=q){
            cout << e  << " " << q-p->first+1<< endl;
            label++;
            break;
          }
        }
      }
      if(label==0) cout << "Unknown" << endl;
    }
  }
  return 0;
}

