#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
int main(void)
{
  for(;;){
    int n,q;
    cin >> n >> q;
    if(!n&&!q) return 0;
    vector<pair<pair<int,int>,string> > tape;
    // (a,b] a<y,y<=b
    REP(i,n){
      string era;
      int th,y;
      cin >> era >> th >> y;
      tape.push_back(make_pair(make_pair(y-th,y),era));
    }
    SORT(tape);
    REP(i,q){
      int y;
      cin >> y;
      int j;
      for(j=0;j<tape.size();++j) if(tape[j].first.first<y&&y<=tape[j].first.second) break;
      if(j<tape.size()) cout << tape[j].second << ' ' << y-tape[j].first.first << endl;
      else cout << "Unknown" << endl;
    }
  }
}