import java.time.Year;
import java.time.YearMonth;

class Main {
    public static void main(String[] args) {
        // Sample year and month strings
        String strYear = "2022";
        String strMonth = "9";
        YearMonth ym = Year.of(Integer.parseInt(strYear))
                .atMonth(Integer.parseInt(strMonth));
        System.out.println(ym);

        // Comparing two instances of YearMonth
        YearMonth currentYm = YearMonth.now();
        if (ym.isAfter(currentYm))
            System.out.println(ym + " is after " + currentYm);
        else
            System.out.println(ym + " is before or equal to " + currentYm);
    }
}
