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