#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, q;
  while (cin >> n >> q, n) {
    vector<string> s(n);
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
      cin >> s[i] >> a[i] >> b[i];
    }
    while (q--) {
      int x;
      cin >> x;
      [&] {
        for (int i = 0; i < n; ++i) {
          if (b[i] - a[i] < x and x <= b[i]) {
            cout << s[i] << ' ' << x + a[i] - b[i] << '\n'; 
            return;
          }
        }
        cout << "Unknown\n";
      }();
    }
  }
}

