uid = []
gets.to_i.times do
  uid << gets.chomp
end

open = false
gets.to_i.times do
  id = gets.chomp
  if uid.include? id
    puts ( open ? "Closed" : "Opened" ) + " by " + id
    open = !open
  else
    puts "Unknown " + id
  end
end