#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, m, i;
    char p = 97;
    cin >> n >> m;
    for (i = 1; i <= n; i++) {
      cout << p;
      (i % m ? p++ : p = 97);
    }
    cout << endl;
  }
  return 0;
}
