#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <climits>
using namespace std;
 
int N, Q;
struct Year {
  string name;
  int base, wy;
  Year() {}
  Year(string name, int base, int wy)
    : name(name), base(base), wy(wy) {}
  bool operator < (const Year &y) const {
    if(wy != y.wy) return wy < y.wy;
    if(base != y.base) return base < y.base;
    return name < y.name;
  }
};
 
vector<Year> v;
int main() {
  while(cin >> N >> Q && (N || Q)) {
    v.clear();
    for(int i = 0; i < N; ++i) {
      Year y;
      cin >> y.name >> y.base >> y.wy;
      y.wy = y.wy - y.base + 1;
      v.push_back(y);
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < Q; ++i) {
      int q;
      cin >> q;
      int p  = distance(v.begin(),lower_bound(v.begin(), v.end(), Year("",INT_MAX,q)));
      if(p == 0 || !(q < v[p-1].wy+v[p-1].base)) cout << "Unknown" << endl;
      else cout << v[p-1].name << " " << q-v[p-1].wy+1 << endl;
    }
  }
  return 0;
}