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

int main() {
  int n, q;
  while (cin >> n >> q, n > 0) {
    vector<tuple<int, int, string>> eras(n);  // (開始年, 終了年, 元号)
    for (int i = 0; i < n; i++) {
      int diff;
      cin >> get<2>(eras[i]) >> diff >> get<1>(eras[i]);
      get<0>(eras[i]) = get<1>(eras[i]) - diff + 1;
    }
    for (int i = 0; i < q; i++) {
      int year;
      cin >> year;
      bool flag = false;
      for (int j = 0; j < n; j++) {
        if (get<0>(eras[j]) <= year && year <= get<1>(eras[j])) {
          cout << get<2>(eras[j]) << ' ' << year - get<0>(eras[j]) + 1 << endl;
          flag = true;
          break;
        }
      }
      if (!flag) cout << "Unknown" << endl;
    }
  }
  return 0;
}
