assignment using priority queue