#include<bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

//-----------------------------------------------------------------------

const int SZ=1005;
int l[SZ],r[SZ];
string name[SZ];

signed main()
{   
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,q;
    while(cin>>n>>q,n)
    {
        REP(i,n){
            int a;
            cin>>name[i]>>a>>r[i];
            l[i]=r[i]-a;
        }
        while(q--){
            int year; cin>>year;
            REP(i,n){
                if(l[i]<year && year<=r[i]){
                    cout<<name[i]<<" "<<year-l[i]<<endl;
                    goto g;
                }
            }
            cout<<"Unknown"<<endl;
        g:;
        }
    }       
} 
