Codeforces Round 921 (Div. 2) A B C

A. We Got Everything Covered!

time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

You are given two positive integers n n n and k k k.

Your task is to find a string s s s such that all possible strings of length n n n that can be formed using the first k k k lowercase English alphabets occur as a subsequence of s s s.

If there are multiple answers, print the one with the smallest length. If there are still multiple answers, you may print any of them.

Note: A string a a a is called a subsequence of another string b b b if a a a can be obtained by deleting some (possibly zero) characters from b b b without changing the order of the remaining characters.

Input

The first line of input contains a single integer t t t ( 1 ≤ t ≤ 676 1\leq t\leq 676 1t676) denoting the number of test cases.

Each test case consists of a single line of input containing two integers n n n ( 1 ≤ n ≤ 26 1\leq n\leq 26 1n26) and k k k ( 1 ≤ k ≤ 26 1\leq k\leq 26 1k26).

Output

For each test case, print a single line containing a single string s s s which satisfies the above property. If there are multiple answers, print the one with the smallest length. If there are still multiple answers, you may print any of them.

Example

input

4
1 2
2 1
2 2
2 3

output

ab
aa
baab
abcbac

Note

For the first test case, there are two strings of length 1 1 1 which can be formed using the first 2 2 2 lowercase English alphabets, and they are present in s s s as a subsequence as follows:

  • a : a b \texttt{a}: {\color{red}{\texttt{a}}}\texttt{b} a:ab
  • b : a b \texttt{b}: \texttt{a}{\color{red}{\texttt{b}}} b:ab

For the second test case, there is only one string of length 2 2 2 which can be formed using the first lowercase English alphabet, and it is present in s s s as a subsequence as follows:

  • aa : aa \texttt{aa}: {\color{red}{\texttt{aa}}} aa:aa

For the third test case, there are 4 4 4 strings of length 2 2 2 which can be formed using the first 2 2 2 lowercase English alphabets, and they are present in s s s as a subsequence as follows:

  • aa : b aa b \texttt{aa}: \texttt{b}{\color{red}{\texttt{aa}}}\texttt{b} aa:baab
  • ab : ba ab \texttt{ab}: \texttt{ba}{\color{red}{\texttt{ab}}} ab:baab
  • ba : ba ab \texttt{ba}: {\color{red}{\texttt{ba}}}\texttt{ab} ba:baab
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值