human
As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan.

The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth.

Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years.

For the simplicity, you can assume the following:

1. A new era always begins on January 1st of the corresponding Gregorian year.
2. The first year of an era is described as 1.
3. There is no year in which more than one era switch takes place.


Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to.


Input

The input contains multiple test cases. Each test case has the following format:

N Q
EraName1 EraBasedYear1 WesternYear1
.
.
.
EraNameN EraBasedYearN WesternYearN
Query1 .
.
.
QueryQ

The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries.

Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet...
#! /u
assistant
#Here is Python code to determine exactly which era the given year belongs to.
sr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n, q = map(int, raw_input().split())
            if n == q == 0:
                break
            db = []
            for i in range(n):
                en, eby, wy = raw_input().split()
                eby = int(eby)
                wy = int(wy)
                db.append((en, wy - eby + 1, wy))
            db.sort(key=lambda x: x[1])
            for i in range(q):
                y = input()
                for en, s, f in db:
                    if s <= y <= f:
                        print en, y - s + 1
                        break
                else:
                    print 'Unknown'
        
        
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()