Under construction

Still being built. Things may change

Chronicle

Interview

Time limit2sMemory limit512 MB

Summary
Given three two-digit numbers from a disk, list every valid 21st-century date dd/mm/yy that uses the three numbers in some order, or report none.
Level

Medium4 of 10

Topics
Implementation, Brute force, Math, Simulation
Solved
No attempts yet

Problem

For several years, scientists in Berland have been excavating the ruins of an ancient civilization that existed centuries before Berland and its neighbors were founded and that, according to indirect evidence, reached an incredibly high level of technology.

Recently, archaeologists found a strange object, presumably a chronicle of certain events, which may reveal to Berland's historians the reason such a powerful society disappeared: a stack of twelve shiny thin disks made of an unknown material, threaded onto a diamond rod. On the top disk, the scientists found three numbers, each consisting of two digits. The scientists guessed that the disk records the date of the end of the great civilization.

After analyzing the disks, they determined that the disks were used in the 21st century according to the calendar used by the ancient civilization, the so-called <> calendar, in which a year of 365365 days was divided into twelve months. The second month of the year lasted twenty-eight days, the first, third, fifth, seventh, eighth, tenth, and twelfth lasted thirty-one days, and the rest lasted thirty days. In special years, whose number was divisible by four and not divisible by one hundred, or was divisible by four hundred, the second month lasted twenty-nine days. A century with number ii was the period from year 100⋅(i−1)+1100 \cdot (i-1) + 1 to year 100⋅i100 \cdot i.

Since it is not known for certain in what order the members of the ancient civilization wrote dates, you, as the chief specialist in the Gregorian calendar, were tasked with a study: to determine which dates in the 21st century the inscription could correspond to, assuming that one of the numbers corresponds to the day of the month (days in each month were numbered from one), another of the numbers to the month number (months were also numbered from one), and the remaining number to the last two digits of the year in the 21st century of the Gregorian calendar.

Given the inscription on the disk, find out which dates in the 21st century it could correspond to.

Input

The input file contains the numbers from the disk in the format aa/bb/ccaa/bb/cc.

Output

In any order, output to the output file all valid dates dd/mm/yydd/mm/yy in the 21st century, where dddd is the day number, mmmm is the month number, and yyyy is the year number, and the numbers corresponding to dddd, mmmm, and yyyy are permutations of the numbers on the disk.

If no permutation of the original numbers is a valid date in the 21st century, output <<No such date>>.

Examples3

  1. Example 1

    Input
    29/02/04
    
    Expected output
    29/02/04
    29/04/02
    02/04/29
    04/02/29
    
  2. Example 2

    Input
    01/01/01
    
    Expected output
    01/01/01
    
  3. Example 3

    Input
    99/99/99
    
    Expected output
    No such date