#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) cout << (char)(i % k + 'a');
    cout << endl;
  }
  return 0;
}
