Under construction

Still being built. Things may change

Naming the Team

Interview

Time limit2sMemory limit1024 MB

Summary
Given three members' solved counts, admission years, and surnames, print a name from the years mod 100 sorted ascending and another from surname initials sorted by solved count.
Level

Easy2 of 10

Topics
Implementation, Sorting, String
Solved
No attempts yet

Problem

Hyundai Mobis runs several talent programs for software developers, including a mobility SW hackathon, an algorithm contest, and a hiring-linked SW academy. The mobility SW hackathon held last February drew 20 teams and about 70 people from software clubs at 14 domestic universities, who competed in mobility software development.

The problem-solving study group SCCC at the School of Computer Science and Engineering, Soongsil University, has to pick a team name every year for team contests such as the mobility SW hackathon, SCON, and ICPC. Seongseo, who graduates one semester from now, wrote a set of guidelines so that members no longer struggle with team names.

According to Seongseo's guidelines, there are two ways to make a team name.

  1. A string made by sorting the remainders of the three members' admission years divided by 100 in ascending order and concatenating them
  2. A string made by listing the first letter of each member's surname in English, ordered from the member who solved the most problems on the online judge to the one who solved the fewest

For example, consider a team of AHN admitted in 2018 with 600 solved problems, LEE admitted in 2019 with 2000, and OH admitted in 2020 with 6000. The first method gives 181920, and the second method gives OLA.

A team of LEE admitted in 2019 with 2000 solved problems, NAH admitted in 2021 with 9000, and PARK admitted in 2022 with 1000 gives 192122 with the first method and NLP with the second.

Input

The first line gives the number of problems P1P_1 solved on the online judge by the first member, their admission year Y1Y_1, and their surname S1S_1, separated by spaces.

The second and third lines give P2,Y2,S2P_2,Y_2,S_2 and P3,Y3,S3P_3,Y_3,S_3 for the second and third members, in the same format as the first line.

Output

Print the team name made by the first method on the first line.

Print the team name made by the second method on the second line.

Constraints

  • 1≤Pi≤20 0001 \leq P_i \leq 20\,000 (1≤i≤3)(1 \leq i \leq 3)
  • All PiP_i are different. (1≤i≤3)(1 \leq i \leq 3)
  • 2010≤Yi≤20992010 \leq Y_i \leq 2099 (1≤i≤3)(1 \leq i \leq 3)
  • All YiY_i are different. (1≤i≤3)(1 \leq i \leq 3)
  • Surnames consist only of uppercase English letters and have at most 5 letters.
  • All surnames are different.
  • All numbers in the input are integers.

Hint

181920 is the bronze-medal team at the 2020 ICPC Asia Seoul Regional Contest, and NLP is the silver-medal team at the 2022 ICPC Asia Seoul Regional Contest.

Examples2

  1. Example 1

    Input
    600 2018 AHN
    2000 2019 LEE
    6000 2020 OH
    
    Expected output
    181920
    OLA
    
  2. Example 2

    Input
    1000 2022 PARK
    9000 2021 NAH
    2000 2019 LEE
    
    Expected output
    192122
    NLP