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++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N, Q;
    for (int N, Q; cin >> N >> Q and N and Q;) {
        vector<pair<int,pair<string, int>>> p;
        rep(i, N) {
            string e;
            int a, b;
            cin >> e >> a >> b;
            p.push_back(make_pair(b, make_pair(e, a)));
        }
        sort(p.begin(), p.end(),[](const pair<int, pair<string, int>>& a, const pair<int, pair<string, int>>& b) {
            return a.first < b.first;
        });
        rep(i, Q) {
            int d;
            cin >> d;
            auto itr = *lower_bound(p.begin(), p.end(), make_pair(d, make_pair("", 0)), [](const pair<int, pair<string, int>>& a, const pair<int, pair<string, int>>& b) -> bool {
                return a.first < b.first;
            });

            if (itr.first-itr.second.second+1 <= d and d <= itr.first) {
                cout << itr.second.first << ' ' << itr.second.second - (itr.first - d) << endl;
            }
            else {
                cout << "Unknown" << endl;
            }
        }
    }
    return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
struct Data {
	string name;
	int start, max;
	bool operator <(Data b) {
		return this->start < b.start;
	}
};
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int n, q;
		cin >> n >> q;
		if (!n)break;
		vector<Data> v(n);
		REP(i, n) {
			cin >> v[i].name >> v[i].max >> v[i].start;
			v[i].start -= v[i].max - 1;
		}
		sort(ALL(v));
		REP(i, q) {
			int a;
			cin >> a;
			int p = -1;
			REP(j, n) {
				if (v[j].start <= a&&v[j].start+v[j].max-1>=a) {
					p = j;
					cout << v[j].name << " " << a-v[j].start+1 << endl;
					break;
				}
			}
			if (p == -1) {
				cout << "Unknown" << endl;
			}
			


		}
	}
	return 0;
}

C++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2242

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Era{

	int from;
	int to;
	string name;

	Era(string era, int w,int g): name(era),from(g - w),to(g){}

	bool isEra(int g){
		return from < g && to >= g;
	}

	void print(int g){
		cout << name << " " << g - from << endl;
	}
};

int main()
{
	int N,Q;
	
	while(cin >> N >> Q && N)
	{
		vector<Era> eras;

		string name;
		int year_w, year_g;
		rep(nth,N)
		{
			cin >> name >> year_w >> year_g;
			for(int i=0; i<year_w; i++){
				eras.push_back(Era(name,year_w, year_g));
			}
		}

		int q;
		rep(nth, Q)
		{
			cin >> q;
			
			bool flag=false;
			rep(i,eras.size())
			{
				if(eras[i].isEra(q))
				{
					eras[i].print(q);
					flag = true;
					break;
				}
			}
			if(!flag){ cout << "Unknown" << endl; }
		}
	}
	return 0;
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,-1,1,0 }, dy[4] = { 1,0,0,-1 };


int main()
{
	int n, q;
	while (cin >> n >> q&&n)
	{
		vector< pair<pii, string> > a;
		FOR(i, n)
		{
			string s;
			int x, y;
			cin >> s >> x >> y;
			a.push_back(make_pair(pii(y - x, y), s));
		}
		FOR(i, q)
		{
			int x; cin >> x;
			bool ok = false;
			FOR(j, n)
			{
				if (a[j].first.first + 1 <= x&&x <= a[j].first.second)
				{
					cout << a[j].second << " " << x - a[i].first.first << endl;
					ok = true;
					break;
				}
			}
			if (!ok)
			{
				cout << "Unknown" << endl;
			}
		}
	}

}