Missing Order

It’s IIKI’s birthday today. He got a function called INSERTER as a gift from OIIKI, one of his mathematician friends. Initially, he has an empty array. With the function, he can perform the following operations on this array.

This is a companion discussion topic for the original entry at https://toph.co/p/missing-order