#include <bits/stdc++.h>
using namespace std;
long long b, c, d, a[101], k, q, n;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> c;
  for (int i = 1; i <= c; i++) {
    cin >> n >> k;
    for (int j = 1; j <= n; j++) {
      if (b < k) {
        s = 'a' + b;
        b++;
      } else {
        s = 'a';
        b = 1;
      }
      cout << s;
    }
    b = 0;
    cout << endl;
  }
  return 0;
}
