#include<iostream>
#include<string>
using namespace std;

int main()
{
    int n, m;

    while( cin >> n >> m )
    {
        if( n + m == 0 )
            break;

        string s[n];
        int y1[n], y2[n], y3;

        for( int i = 0; i < n; i++ )
            cin >> s[i] >> y1[i] >> y2[i];

        for( int i = 0; i < m; i++ )
        {
            cin >> y3;
            bool judge = false;
            for( int j = 0; j < n; j++ )
            {
                if( y2[j] - y3 >= 0 && y1[j] - ( y2[j] - y3 ) > 0 )
                {
                    cout << s[j] << " " << y1[j] - ( y2[j] - y3 ) << endl;
                    judge = true;
                }
            }
            if( !judge )
                cout << "Unknown" << endl;
        }
    }
    return 0;
}

