Under construction

Still being built. Things may change

Uni's Letter Writing

Interview

Time limit1sMemory limit1024 MB

Summary
Given each friend's enlistment and discharge months, find the earliest month when the most friends are in the military.
Level

Easy3 of 10

Topics
Prefix sum, Array
Solved
No attempts yet

Problem

Uni, who graduated from an all-boys middle and high school, has many friends in the military around them. Uni wants to write letters to the friends who are serving.

But Uni finds it tiresome to write to so many friends, so Uni decides to write letters for one month only.

If Uni writes only during one month, some friends will not receive any letters while in the military. So Uni wants to find the one month when the most friends are in the military.

Uni is not good at figuring things out, so help Uni find when to write the letters.

Input

The first line contains the number of Uni's friends NN who enter the military. (1≤N≤100 0001 \leq N \leq 100\,000)

From the second line, each of the next NN lines gives the enlistment month and the discharge month of a friend in the form YYYY-MM.

YYYY is the year, an integer from 20002000 to 99999999.

MM is the month, an integer from 11 to 1212. A single-digit month is written with a leading 0.

The enlistment month and the discharge month are both months in which the friend is in the military. The discharge month is always the same as or later than the enlistment month.

Output

Print the time when Uni should write letters in the form YYYY-MM. If there are several such times, print the earliest one.

Examples1

  1. Example 1

    Input
    4
    2023-02 2023-04
    2023-03 2025-03
    2023-04 2025-02
    2024-02 2026-02
    
    Expected output
    2023-04