Phoenix And Distribution
easy
Link -> Phoenix and Distribution
Constraints
check the link
Format
Input
check the link
Output
check the link
Example
Sample Input
6
4 2
baba
5 2
baacb
5 3
baacb
5 3
aaaaa
6 4
aaxxzz
7 1
phoenix
Sample Output
ab
abbc
b
aa
x
ehinopx