class List
  attr_accessor :data, :nnext, :prev

  @@first_node = nil
  @@current_node = nil
  # @@node_count = 0

  def initialize(data=nil, nnext=nil, prev=nil)
    @data = data
    @nnext = nnext
    @prev = prev
    # unless data == "END"
    #   @@node_count += 1
    # end
  end

  def self.inti
    @@current_node = List.new("END")
    @@first_node = @@current_node
  end

  # def self.node_count
  #   @@node_count
  # end

  # def self.first_node
  #   @@first_node
  # end

  # def self.current_node
  #   @@current_node
  # end
  
  def self.insert(data)
    new_node = List.new(data)
    new_node.nnext = @@current_node

    unless @@current_node.prev.nil?
      new_node.prev = @@current_node.prev
      @@current_node.prev.nnext = new_node
    else
      @@first_node = new_node
    end

    @@current_node.prev = new_node
    @@current_node = new_node

  end

  def self.move(n)
    n.abs.times do
      @@current_node = (n < 0) ? @@current_node.prev : @@current_node.nnext
    end
  end

  def self.erase

    unless @@current_node.prev.nil?
      @@current_node.prev.nnext = @@current_node.nnext
    end

    @@current_node.nnext.prev = @@current_node.prev
    @@current_node = @@current_node.nnext

    if @@current_node.prev.nil?
      @@first_node = @@current_node
    end

    # @@node_count -= 1
  end

  def self.output
    until @@first_node.data == "END"
      puts @@first_node.data
      @@first_node = @@first_node.nnext
    end
  end
end

n = gets(chomp:true).to_i
query = readlines(chomp:true).map{|l|l.split.map(&:to_i)}

List.inti
query.each do |que|
  case que[0]
  when 0
    List.insert(que[1])
  when 1
    List.move(que[1])
  when 2
    List.erase
  end
end
List.output
