In a city parade, there is a long banner with
There are
For each group, you are given
After all votes are counted, each position of the banner will show the letter with the maximum number of votes at that position.
If more than one letter has the same maximum number of votes, choose the lexicographically smallest letter.
Your task is to print the final banner.
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the length of the banner and the number of groups.
Each of the next KaTeX can only parse string typed expression lines contains two integers KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and one lowercase English letter KaTeX can only parse string typed expression.
Print a single string of length KaTeX can only parse string typed expression — the final banner after all votes are counted.
Input
6 5
1 3 b
2 5 a
4 6 c
3 6 c
1 6 bOutputbbbcccExplanationAt positions KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression, letter KaTeX can only parse string typed expression gets the highest votes. At positions KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression, letter KaTeX can only parse string typed expression gets the highest votes. So the final banner is KaTeX can only parse string typed expression.