hash = {}
cur = 0

STDIN.gets.to_i.times do
  q = STDIN.gets.split
  case q[0]
  when '0' then
    hash[cur - 1] = q[1].to_i
    cur -= 1
  when '1' then
    cur = hash.keys[hash.keys.index(cur) - q[1].to_i]
  when '2' then
    hash.delete(cur)
    cur += 1
  end
end

puts hash.sort.map{|arr| arr[1]}

