#include <bits/stdc++.h>
using namespace std;

void solve()
{
    int n, k;
    cin >> n >> k;
    
    string s = "";
    
    for(int i = 0; i < k; i++)
        s.push_back('a' + i);
        
    for(int i = 0; i < n; i++)
        cout << s;
        
    cout << endl;
}

int main() {
    // your code goes here
    int t;
    cin >> t;
    
    while(t--)
        solve();
}