Implement stack using priority queue.