using stack to implement queue