how does the queue data structure work