def lower_bound(arr, v)
  l = -1
  r = arr.size
  while l + 1 < r
    m = (l + r) / 2
    if arr[m] <= v then l = m
    else r = m
    end
  end
  l
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 = lower_bound(k, y)
    if x != -1 && y == k[x]
      puts "#{v[x][0]} #{v[x][1]}"
    elsif x != n - 1
      if k[x+1] - y < v[x+1][1]
        puts "#{v[x+1][0]} #{v[x+1][1] - (k[x+1] - y)}"
      else puts "Unknown"
      end
    else puts "Unknown"
    end
  end
end