#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<fstream>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
#define f first
#define s second

int main(){
  int n,m;

  while(cin>>n>>m){
    vector<pair<int,pair<int,string> > > jp(n);
    REP(i,n){
      int a,b;
      string s;
      cin>>s>>a>>b;
      jp[i].f = b - a + 1;
      jp[i].s.f = a;
      jp[i].s.s = s;
    }

    sort(jp.begin(), jp.end());

    REP(i,m){
      int ans = -1;
      int q;
      cin>>q;
      REP(j,n){
        if(jp[j].f <= q && jp[j].f+jp[j].s.f > q){
          ans = j;
          break;
        }
      }
      if(ans == -1) cout << "Unknown" << endl;
      else cout << jp[ans].s.s << " " << q - jp[ans].f + 1 << endl;
    }
  }
  return 0;
}