#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6;
const long long LINF = 1e18;
using namespace std;
long long n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz");
bool fl;
struct edge {
  int to, cost;
};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    string s, co;
    cin >> a >> b;
    char ss;
    cnt = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      s += c;
      co += c;
      cnt++;
      if (cnt == b) {
        ss = c;
        break;
      }
    }
    while (1) {
      if ((s).size() + (co).size() >= a) break;
      co += s;
    }
    for (char c = 'a'; c <= 'z'; c++) {
      if ((co).size() == a) break;
      co += c;
      if ((co).size() == a) break;
    }
    cout << (co) << endl;
  }
  return 0;
}
