Sort N distinct handles by ASCII dictionary order and print the I-th one.
Easy2SortingStringImplementationInterviewNo attempts yetTime limit1sMemory limit512 MBOn online judges and in programming contests, each participant is known by an ID, also called a handle. Many people reuse the same handle across sites, and a famous user's handle is sometimes used like a nickname.
Sangmin uses the handle qilip. However, Hyeonjeong only remembers that it starts with q and ends with p, so she calls him qp. Determined to defend his identity, Sangmin wants to imprint his real handle on her.
Hyeonjeong is bad at matching names to faces, but she has one peculiar talent: she remembers the rank of every handle she knows once those handles are arranged in dictionary order. Given the list of handles she knows and an integer I, find the handle ranked I-th in dictionary order.
The first line contains N, the number of handles Hyeonjeong knows, and I, the rank to find (1≤I≤N≤100).
Each of the following N lines contains one handle in random order. Every handle consists of lowercase English letters and digits only, with length between 1 and 20 inclusive. All handles are distinct.
Print the I-th handle in dictionary order on one line.
Dictionary order here is defined as follows. Digits come before letters, smaller digits come first, and earlier letters come first. If one string is a prefix of another, the shorter one comes first.