#include <bits/stdc++.h>
#define ll long long int
#define ld long double
using namespace std;
void mainSolve()
{
int n, x;
cin >> n >> x;
if (n == 1)
{
cout << "a\n";
return;
}
if (n < (2 * x) - 1)
{
cout << "-1\n";
return;
}
string ans = "";
int i = 0;
for (char a = 'a'; i < x; i++, a++)
ans += a;
string last = ans;
reverse(last.begin(), last.end());
n -= (2 * x);
if (n < 0)
{
cout << ans;
for (int i = x - 2; i >= 0; i--)
cout << ans[i];
cout << endl;
return;
}
while (n--)
ans += 'a';
ans += last;
cout << ans << endl;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--)
{
mainSolve();
}
return 0;
}