Go: package main

import (
	"fmt"
	"sort"
)

type Datum struct {
	EraName      string
	EraBasedYear int64
	WesternYear  int64
}

const Unknown = "Unknown"

func lowerBound(data []*Datum, westernYearBorder int64) int {
	imin := -1
	imax := len(data)
	for imax-imin > 1 {
		imid := (imax + imin) / 2
		if data[imid].WesternYear >= westernYearBorder {
			imax = imid
		} else {
			imin = imid
		}
	}
	return imax
}

func solve(n, q int) {
	data := make([]*Datum, 0, n)
	for index := 0; index < n; index++ {
		datum := Datum{}
		fmt.Scan(&datum.EraName, &datum.EraBasedYear, &datum.WesternYear)
		data = append(data, &datum)
	}
	sort.Slice(data, func(i, j int) bool {
		return data[i].WesternYear < data[j].WesternYear
	})
	for cnt := 0; cnt < q; cnt++ {
		var query int64
		fmt.Scan(&query)
		var index int
		if index = lowerBound(data, query); index == n {
			fmt.Println(Unknown)
			continue
		}
		possibleDatum := data[index]
		if possibleDatum.WesternYear-query > possibleDatum.EraBasedYear-1 {
			fmt.Println(Unknown)
			continue
		}
		ans := possibleDatum.EraBasedYear - (possibleDatum.WesternYear - query)
		fmt.Println(possibleDatum.EraName, ans)
	}
}

func main() {
	for {
		var n, q int
		if fmt.Scan(&n, &q); n == 0 && q == 0 {
			break
		}
		solve(n, q)
	}
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n, q;
  while (cin >> n >> q, n) {
    vector<tuple<string, int, int>> v;
    while (n--) {
      string s;
      int a, b;
      cin >> s >> a >> b;
      v.emplace_back(s, b - a, b);
    }
    while (q--) {
      int x;
      cin >> x;
      ([&]() {
        for (auto &t : v) {
          string s;
          int a, b;
          tie(s, a, b) = t;
          if (a < x && x <= b) {
            cout << s << ' ' << x - a << endl;
            return;
          }
        }
        cout << "Unknown" << endl;
      })();
    }
  }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<string, P> PSP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
  cin.sync_with_stdio(false);
  int n, q;
  while(cin >> n >> q, n | q) {
    vector<PSP> v(n);
    rep(i, n) {
      cin >> v[i].fi;
      int tmp;
      cin >> tmp >> v[i].se.se;
      v[i].se.fi = v[i].se.se - tmp + 1;
    }

    rep(i, q) {
      int y;
      cin >> y;
      string ans = "Unknown";
      rep(i, n) {
        if (v[i].se.fi <= y && y <= v[i].se.se) {
          ans = v[i].fi + " " + to_string(y - v[i].se.fi + 1);
          break;
        }
      }
      cout << ans << endl;
    }
  }


  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define mp make_pair
typedef pair<int,int>P;

int main(){
	int N,M;
	while(cin>>N>>M,N){
		map<string,P>data;
		string name[1001];
		
		string tmp;
		
		for(int i=0,a,b;i<N;i++){
			cin>>name[i]>>a>>b;
			data[name[i]]=mp(b-a+1,b);
		}
		
		for(int i=0,a,f,j;i<M;i++){
			cin>>a;
			for(f=1,j=0;j<N;j++){
				if(data[name[j]].first<=a&&a<=data[name[j]].second&&f){
					f=0;
					cout<<name[j]<<" "<<a-data[name[j]].first+1<<endl;
				}
			}
			if(f)cout<<"Unknown"<<endl;
		}
		
	}
	
	
	
	
	return 0;
}

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

int main() {
	int n, q;
	while (cin >> n >> q, n) {
		vector<pair<pair<int, int>, string>> v;
		for (int i = 0; i < n; i++) {
			string s;
			int a, b;
			cin >> s >> a >> b;
			v.push_back(make_pair(make_pair(b - a, b), s));
		}
		for (int i = 0; i < q; i++) {
			int a;
			cin >> a;
			bool f = false;
			for (auto it = begin(v); it != end(v); it++) {
				if (it->first.first < a && a <= it->first.second) {
					cout << it->second << " " << a - it->first.first << endl;
					f = true;
					break;
				}
			}
			if (!f) {
				cout << "Unknown" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main(){
  int N, Q;
  while(cin >> N >> Q, N){
    map<int, string> M;
    map<string, int> E;
    string eraname;
    int eb, w;
    for(int i = 0; i < N; ++i){
      cin >> eraname >> eb >> w;
      M[w-eb] = eraname;
      E[eraname] = w;
    }
    for(int i = 0; i < Q; ++i){
      cin >> w;
      int t = 0;
      eraname = "Unknown";
      for(map<int, string>::iterator iter = M.begin(); iter != M.end(); ++iter){
    if(iter->first < w && w <= E[iter->second]){
      eraname = iter->second;
      t = w - iter->first;
    }else if(iter->first >= w) break;
      }
      cout << eraname;
      if(t) cout << " " << t;
      cout << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
//typedef pair<int, int> P;
struct P {
	int x, y;
	P(int x, int y):x(x), y(y){}
	P(){}
};

/** Problem2242 : Era Name **/
struct Era {
	int s, e;
	string name;
	Era(int _s, int _e, string _name):s(_s), e(_e), name(_name){}
	Era(){}
};

int main()
{
	int N, M;
	cin>>N>>M;
	
	vector<Era> era(N);
	rep(i, N) {
		int a, b;
		cin>>era[i].name>>a>>b;
		era[i].e = b;
		era[i].s = b-a+1;
	}
	
	rep(i, M) {
		int a; cin>>a;
		bool ok=false;
		rep(j, N) {
			if (era[j].s <= a && a <= era[j].e) {
				cout << era[j].name << " " << a-era[j].s+1 << endl;
				ok=true;
				break;
			}
		}
		if (!ok)
			cout << "Unknown" << endl;
	}
}