#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

vector<pair<int, pair<int, string> > > data;

int val;

int get_era(int q){
  int tmp = -1;
  for(int i=0;i<data.size();i++){
    if(data[i].first <= q && q <= (data[i].second).first){
      val = q-data[i].first;
      return i;
    }
  }
  return -1;
}

int main(){
  int N, Q;
  while(cin >> N >> Q){
    if(N == 0 && Q == 0) break;
    data.clear();
    for(int i=0;i<N;i++){
      string name;
      int era, west;
      cin >> name >> era >> west;
      data.push_back(make_pair(west-era+1, make_pair(west, name)));
    }
    sort(data.begin(), data.end());
    for(int i=0;i<Q;i++){
      int q, ans;
      cin >> q;
      ans = get_era(q);
      if(ans == -1) cout << "Unknown" << endl;
      else cout << (data[ans].second).second << ' ' << val+1 << endl;
    }
  }
  return 0;

}