public ListNode mergeKLists(List<ListNode> lists) {
		ListNode dummy=new ListNode(0),p=dummy;
		Queue<ListNode> pq=new PriorityQueue<>((a,b)->a.val-b.val);
		for (ListNode node:lists)
			if (node!=null)
				pq.offer(node);
		while (!pq.isEmpty()) {
			ListNode c=pq.poll();
			p.next=c;
			if (c.next!=null)
				pq.offer(c.next);
		}
		return dummy.next;
	}