#include <bits/stdc++.h>
#include <stdint.h>

typedef uint32_t u32;
typedef uint64_t u64;
typedef std::pair<int, int> pii;
constexpr int INF = (1 << 28);

int main() {

  std::string eraname[2000];
  int erabasedyear[2000];
  int westernyear[2000];
  
  for(;;) {
    int N, Q; std::cin >> N >> Q;
    if( N == 0 and Q == 0 ) break;

    for(int i = 0; i < N; ++i) {
      std::cin >> eraname[i] >> erabasedyear[i] >> westernyear[i];
    }
    for(int i = 0; i < Q; ++i) {
      int query; std::cin >> query;
      std::string era;
      int res = INF;      
      for(int j = 0; j < N; ++j) {
        if( query > westernyear[j] ) continue;
        auto t = query - westernyear[j] + erabasedyear[j];
        if( t <= 0 ) continue;
        if( t < res ) {
          res = t;
          era = eraname[j];
        }
      }
      if( res == INF ) {
        std::cout << "Unknown" << std::endl;
      }
      else {
        std::cout << era << ' ' << res << std::endl;
      }
    }    
  }
  
  return 0;
}