// Aizu 2242: Era Name
// 2017.9.23 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

#define MAX 1001
typedef struct { char nm[17]; int e, w; } ERA;	// ??´???, ??????????????´????????????????\????????????´
ERA era[MAX]; int n;	// ??´?????????????????????????????????
 
int cmp(ERA *a, ERA *b) { return a->w - b->w; }

// ?????????????????????
int bsch(int x)
{
	int m, l = 0, r = n;

    while (l < r) {
        m = (l + r) >> 1;
        if (era[m].w < x) l = m + 1; else r = m;
    }
	return l;
}

int main()
{
	int q, i, y;

	while (scanf("%d%d", &n, &q) && n > 0) {
		// ?????±?????????????????¨??´????????????????????????
		for (i = 0; i < n; i++) scanf("%s%d%d", era[i].nm, &era[i].e, &era[i].w);
		qsort(era, n, sizeof(ERA), cmp);

		while (q-- > 0) {
			scanf("%d", &y);
			i = bsch(y);		// ?????????????????????
			if (i >= 0 && i < n && era[i].w-era[i].e+1 <= y && y <= era[i].w)
				printf("%s %d\n", era[i].nm, y-era[i].w+era[i].e);
			else puts("Unknown");
		}
	}
	return 0;
}