#CCBOTPBA0000027. Ngày thứ n trong năm (Nth Day of a Year)

Ngày thứ n trong năm (Nth Day of a Year)

Nth Day of a Year

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given the 1-based day of year n and year y, output the corresponding day month year using Gregorian leap-year rules.

Input

Two integers n y.

Output

Three integers d m y separated by spaces, with no zero padding.

Subtasks

  • Subtask 1 (20%): 1 ≤ y ≤ 100; valid n within the year.

  • Subtask 2 (30%): 1 ≤ y ≤ 2000; valid n within the year.

  • Subtask 3 (50%): 1 ≤ y ≤ 9999; valid n within the year.

Examples

Example 1

Input:

60 2024

Output:

29 2 2024

Explanation: 2024 is leap, so the 60th day is February 29.

Example 2

Input:

60 2023

Output:

1 3 2023

Explanation: 2023 is not leap, so the 60th day is March 1.