#include<iostream>
using namespace std;

int main(){
  int n,q,i;
  int j,b[1010],e[1010],y;
  string name[1010];

  while(cin >> n >> q, n+q){
    for(i=0;i<n;i++){
      cin >> name[i] >> j >> e[i];
      b[i] = e[i]-j+1;
    }

    for(i=0;i<q;i++){
      cin >> y;
      for(j=0;j<n;j++){
	if(b[j]<= y && y<=e[j]){
	  cout << name[j] << " " << y-b[j]+1 << endl;
	  break;
	}
      }
      if(j==n)cout << "Unknown\n";
    }
  }
}