Construct the String

You are given three positive integers n, a and b. You have to construct a string s of length n consisting of lowercase Latin letters such that each substring of length a has exactly b distinct letters. It is guaranteed that the answer exists.

You have to answer t independent test cases.

Recall that the substring s[lr] is the string sl,sl+1,,sr and its length is rl+1. In this problem you are only interested in substrings of length a.Input

The first line of the input contains one integer t (1t2000) — the number of test cases. Then t test cases follow.

The only line of a test case contains three space-separated integers n, a and b (1an2000,1bmin(26,a)), where n is the length of the required string, a is the length of a substring and b is the required number of distinct letters in each substring of length a.

It is guaranteed that the sum of n over all test cases does not exceed 2000 (n2000).Output

For each test case, print the answer — such a string s of length n consisting of lowercase Latin letters that each substring of length a has exactly b distinct letters. If there are multiple valid answers, print any of them. It is guaranteed that the answer exists.Exampleinput

4
7 5 3
6 1 1
6 6 1
5 2 2

output

tleelte
qwerty
vvvvvv
abcde

Note

In the first test case of the example, consider all the substrings of length 5:

  • “tleel”: it contains 3 distinct (unique) letters,
  • “leelt”: it contains 3 distinct (unique) letters,
  • “eelte”: it contains 3 distinct (unique) letters.

Solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
int n, a, b;
cin >> n >> a >> b;
string s(a, ' ');
for (int i = 0; i < a; i++) s[i] = (char) ('a' + i % b);
    for (int i = 0; i < n; i++) cout << s[i % a];
    cout << '\n';
  }
  return 0;
}