#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);
	while(1){
		int N, Q;
		cin >> N >> Q;
		if( N == 0 && Q == 0 ) break;

		vector< string > vs;
		vector< int > st;
		vector< int > wc;
		for(int i = 0; i < N; i++) {
			string s;
			int j, k;
			cin >> s >> j >> k;
			vs.push_back( s );
			st.push_back( j );
			wc.push_back( k );
		}

		for(int i = 0; i < Q; i++) {
			int j;
			bool flg = false;
			cin >> j;
			for(int k = 0; k < N; k++) {
				if( j > wc[k] - st[k] && j <= wc[k] ) {
					cout << vs[k] << " " << j - wc[k] + st[k] << endl;
					flg = true;
					break;
				}
			}
			if( flg == false )
				cout << "Unknown" << endl;
		}

 	}

	//while(1){}
    return 0;
}