#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;

#define all(c) (c).begin(), (c).end()

int main(){
    int N, Q;
    while(cin >> N >> Q, N|Q){
        typedef tuple<int, int, string> Data;
        vector<Data> era;
        while(N--){
            string name;
            int eyear, wyear;
            cin >> name >> eyear >> wyear;
            era.emplace_back(wyear - eyear + 1, wyear, name);
        }
        sort(all(era));
        auto comp = [](Data& d, int x){return get<1>(d) < x;};
        while(Q--){
            int query, one = 0, known = 0;
            string name;
            cin >> query;
            if(query <= get<1>(era.back()))tie(one, known, name) = *lower_bound(all(era), query, comp);
            if(one <= query && query <= known)cout << name << " " << query - one + 1 << '\n';
            else cout << "Unknown\n";
        }
    }
    return 0;
}