#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q, f, j, t, i, n[100], c[100];
  string s[100];
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> n[i];
    cin >> c[i];
    s[i] = "abcdefghijklmnopqrstuvwxyz";
  }
  for (i = 0; i < t; i++) {
    if (n[i] % c[i] == 0) {
      for (f = 0; f < n[i] / c[i]; f++)
        for (j = 0; j < c[i]; j++) cout << s[i][j];
      cout << "\n";
    } else {
      for (f = 0; f < n[i] / c[i]; f++)
        for (j = 0; j < c[i]; j++) cout << s[i][j];
      for (f = 0, j = 0; j < c[i], f < n[i] % c[i]; f++, j++) cout << s[i][j];
      cout << "\n";
    }
  }
  return 0;
}
