#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    int j = 0;
    while (j < a) {
      char k = 'a' + b;
      for (char r = 'a'; r < k; r++) {
        if (j < a) {
          cout << r;
          j++;
        }
      }
    }
    cout << endl;
  }
}
