n = gets(chomp:true).to_i
l_list = []
cursor = 0

n.times do
  order, value = gets.split.map(&:to_i)
  case order
  when 0
    if cursor == 0
      l_list.unshift(value)
    else
      l_list[cursor -= 1] = value
    end
  when 1
    cursor += value
  when 2
    l_list.delete_at(cursor)
  end
end

puts l_list
