#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, i, K, N, j;
  cin >> T;
  char name[27];
  for (i = 1; i <= 26; i++) {
    char a = 'a' + i - 1;
    name[i] = a;
  }
  while (T--) {
    cin >> N >> K;
    i = 1, j = 1;
    while (i <= N) {
      cout << name[j];
      i++;
      j++;
      if (j == K + 1) j = 1;
    }
    cout << endl;
  }
  return 0;
}
