Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
File size: 1,149 Bytes
c623d8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Jack is blessed with a baby and he and his wife want to name their child. Jack
is a mathematician and his wife is very superstitious. She wants the baby's
name to contain at least one of her ancestors names as a substring. They have
decided that the baby's name should be exactly **L** characters long, and will
only consist of lowercase characters. Jack's wife gives Jack a list of **N**
strings, the names of her ancestors. Jack finds all the name possible names
for his baby and lists them in alphabetical order. He asks you to choose the
**K**th (1-based) name in the list as the name for his child.

## Input

The first line contains **T**, the number of test cases. Each test case begins
with the value of **L** followed by a single integer **K**. The next line
contains a single integer **N** followed by **N** lines, each containing the
name of one of the wife's ancestors.

## Output

For every test case output the name for the child. If no such name exists
print "unnamed baby :(".

## Constraints

1 ≤ **T** ≤ 20  
1 ≤ **L** ≤ 100  
1 ≤ **N** ≤ 100  
1 ≤ length of each string in the list ≤ 100  
1 ≤ **K** ≤ 1018