an implementation of queue