#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, n, k, i, j;
  cin >> q;
  char a[] = "abcdefghijklmnopqrstuvwxyz", b[100];
  while (q--) {
    cin >> n >> k;
    for (i = 0, j = 0; i < n; j++, i++) {
      if (j == k) {
        j = 0;
      }
      b[i] = a[j];
    }
    b[i] = '\0';
    cout << b << endl;
  }
}
