PriorityQueue<Pair<Integer,Integer> > pq= new PriorityQueue<Pair<Integer,Integer>>(n, Comparator.comparing(Pair::getKey));