#include<stdio.h>
int main(){
  int n,m,a[1010],b[1010],y,i;
  char s[1010][1010];
  while(scanf("%d %d",&n,&m),n){
    for(i=0;i<n;i++)scanf("%s %d %d",s[i],&a[i],&b[i]);
    while(m--){
      scanf("%d",&y);
      for(i=0;i<n;i++){
	if(b[i]-a[i]<y&&y<=b[i])break;
      }
      i-n?printf("%s %d\n",s[i],y-b[i]+a[i]):printf("Unknown\n");
    }
  }
  return 0;
}