#include <map>
#include <string>
#include <iostream>
using namespace std;
struct er{
    string gengo;
    int start;
    int end;
};

int main(){
    int N,Q,i,f,t,y;
    string buf;
    map<int,er> mp;
    while(1){
        mp.clear();
        cin >> N >> Q;
        if(!N && !Q){break;}
        for(i=0;i<N;i++){
            cin >> buf >> f >> t;
            struct er e={buf,t-f+1,t};
            mp[t-f+1]=e;
        }
        for(i=0;i<Q;i++){
            cin >> y;
            auto itr=mp.upper_bound(y);
            if(itr!=mp.begin()){
                itr--;
            }
            if(itr->second.start <= y && itr->second.end >= y){
                cout << itr->second.gengo << " " << y-itr->first+1 << endl;
            }
            else{
                cout << "Unknown" <<endl;
            }
        }
    }
    return 0;
}


    

