def lower_bound(arr, v)
  l = -1
  r = arr.size
  while l + 1 < r
    m = (l + r) / 2
    if arr[m][2] < v then l = m
    else r = m
    end
  end
  l + 1
end

loop do
  n, q = gets.split.map(&:to_i)
  break if n == 0
  era = []
  n.times do
    name, ey, wy = gets.split
    era << [name, ey.to_i, wy.to_i]
  end
  era.sort_by! { |e| e[2] }
  q.times do
    y = gets.to_i
    x = lower_bound(era, y)
    if x != n && era[x][2] - y < era[x][1]
        puts "#{era[x][0]} #{era[x][1] - (era[x][2] - y)}"
    else puts "Unknown"
    end
  end
end