def search(arr, v, l, r)
  if l == r
    if v <= arr[l]
      return l
    else
      return l + 1
    end
  elsif v <= arr[l + (r - l) / 2]
    return search(arr, v, l, l + (r - l) / 2)
  else
    return search(arr, v, l + (r - l) / 2 + 1, r)
  end
end

loop do
  n, q = gets.split.map(&:to_i)
  break if n == 0
  era = {}
  n.times do
    name, ey, wy = gets.split
    era[wy.to_i] = [name, ey.to_i]
  end
  era = era.sort
  q.times do
    y = gets.to_i
    k = era.transpose[0]
    v = era.transpose[1]
    x = search(k, y, 0, n - 1)
    if x != n && k[x] - y < v[x][1]
      puts "#{v[x][0]} #{v[x][1] - (k[x] - y)}"
    else puts "Unknown"
    end
  end
end