PriorityQueue<Integer> pq = new PriorityQueue<> ();

for(int i = 0; i < N; i++){
	int data = sc.nextInt();
	pq.add(data);// priorityQueue에 원소를 추가
}

data1 = pq.remove(); // 원소를 반환하고 제거
data2 = pq.remove();