#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
struct  aa
{
    char name[20];
    int year1;
    int year2;
}sb[1010];
int main()
{
    int n,m,i,j,query,ans;
    while(~scanf("%d%d",&n,&m))
    {
        if(n==0&&m==0)break;
        for(i=0;i<n;i++)
            scanf("%s%d%d",sb[i].name,&sb[i].year1,&sb[i].year2);
        for(i=0;i<m;i++)
        {
            ans=0;
            scanf("%d",&query);
            for(j=0;j<n;j++)
                if(sb[j].year2>=query)
                {
                    ans=sb[j].year1-sb[j].year2+query;
                    if(ans>0)break;
                }
            if(ans>0)
                printf("%s %d\n",sb[j].name,ans);
            else printf("Unknown\n");
        }
    }
return 0;
}