кто-нибудь подскажите пожалуйста, почему не работает мой код?
package com.javarush.task.pro.task04.task0410;
import java.util.Scanner;
/*
Второе минимальное число из введенных
*/
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
Scanner sc = new Scanner (System.in);
int a;
int b;
int c = 0;
int d = 0;
while (sc.hasNextInt()){
a = sc.nextInt();
b = sc.nextInt();
if (a > b) {
c = b;
}
else if (a < b) {
d = a;
}
else {
d = a;
}
}
if (d < c) {
System.out.println (c);
}
else if (d > c) {
System.out.println (d);
}
else {
System.out.println (d);
}
}
}