#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int i = 0;
    while (i < n) {
      char ch = 'a';
      int j = 0;
      while (j < k && i < n) {
        cout << ch;
        ch++;
        j++;
        i++;
      }
    }
    cout << endl;
  }
}
