simple priority queue problem