#include<iostream>
#include<cstring>
#include<string>
using namespace std;
typedef struct{
  string str;
  int start,end;
}P;
int main(){
  int n,m,a;
  while(1){
    cin >> n >> m;
    if(n==0&&m==0)break;
    P data[n];
    for(int i=0;i<n;i++){
      cin >> data[i].str >> a >> data[i].end;
      data[i].start = data[i].end - a + 1;
    }
    for(int i=0;i<m;i++){
      cin >> a;
      bool ok=false;
      for(int j=0;j<n;j++){
	if(data[j].start<=a&&data[j].end>=a){
	  ok = true;
	  cout << data[j].str << " " << a-data[j].start+1 << endl;
	}
      }
      if(!ok)cout << "Unknown" << endl;
    }
  }
}