fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main () {
  6.  
  7. int t; cin>> t;
  8.  
  9. while (t--) {
  10.  
  11. int n,k; cin >> n >> k;
  12.  
  13. string s="";
  14.  
  15. for (int i=0; i<k; i++) {
  16.  
  17. s+=('a'+i);
  18. }
  19.  
  20. for (int i=0; i<n; i++) {
  21.  
  22. cout << s;
  23. }
  24.  
  25. cout << endl;
  26. }
  27. }
Success #stdin #stdout 0s 5332KB
stdin
4
1 2
2 1
2 2
2 3
stdout
ab
aa
abab
abcabc