This page is still under construction.

Parts of this page are still being built. What you see may change.

Identify, Sort, Index, Solve

Time limit1sMemory limit512 MB

Summary
Given N problem titles with numbers and difficulties, sort them by number and output the uppercased D-th character of each title in that order.
Level

Easy2 of 10

Topics
Sorting, Implementation, String
Solved
No attempts yet

Problem

ISIS puzzles are puzzles solved with the procedure Identify, Sort, Index, Solve.

Haibi, who likes puzzles, decided to write ISIS puzzle problems for HCPC, like the one below.

  1. You are given NN strings S1,S2,…,SNS_1, S_2, \ldots, S_N.
  2. Identify: Find the title that matches each string, then find that problem's number IiI_i and difficulty DiD_i.
  3. Sort: Sort the problems in ascending order of their number IiI_i.
  4. Index: From each problem name SiS_i, extract the DiD_i-th character. If the extracted character is lowercase, convert it to uppercase.
  5. Solve: Arrange the characters extracted in the Index step in the order sorted in the Sort step.

Input

The first line contains the number of entries NN. (1≤N≤1001 \le N \le 100)

From the second line, NN lines follow, each with a problem title SiS_i, number IiI_i, and difficulty DiD_i. (1≤∣Si∣≤1001 \le |S_i| \le 100; 1≤Ii≤100 0001 \le I_i \le 100\,000; 1≤Di≤∣Si∣1 \le D_i \le |S_i|)

SiS_i consists only of uppercase and lowercase English letters and digits.

No two problems have the same number.

Output

Print the string obtained after the Solve step.

Examples2

  1. Example 1

    Input
    8
    Ep2ascii 7 3
    Xtreme2s 5 7
    AndAHalf 1 5
    May2Year 8 4
    PCMaudio 3 1
    Logicism 2 5
    Electric 4 8
    2048Half 6 2
    
    Expected output
    HCPC2022
    
  2. Example 2

    Input
    10
    BearAndThreeMusketeers 1661 9
    GlebAndPizza 1441 7
    LittleElephantAndInversions 2662 19
    NewYearBookReading 1991 13
    PalindromesColoring 2332 16
    PashmakAndParmidasProblem 2442 15
    SendingASequenceOverTheNetwork 3003 7
    TextVolume 1221 10
    TheHardWorkOfPaparazzi 2112 10
    VotingForPhotos 808 9
    
    Expected output
    REDHERRING