1. //Utkarsh.25dec
  2. #include <bits/stdc++.h>
  3. #define ll long long int
  4. #define pb push_back
  5. #define mp make_pair
  6. #define mod 1000000007
  7. #define vl vector <ll>
  8. #define all(c) (c).begin(),(c).end()
  9. using namespace std;
  10. ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
  11. ll modInverse(ll a){return power(a,mod-2);}
  12. const int N=500023;
  13. bool vis[N];
  14. vector <int> adj[N];
  15. long long readInt(long long l,long long r,char endd){
  16. long long x=0;
  17. int cnt=0;
  18. int fi=-1;
  19. bool is_neg=false;
  20. while(true){
  21. char g=getchar();
  22. if(g=='-'){
  23. assert(fi==-1);
  24. is_neg=true;
  25. continue;
  26. }
  27. if('0'<=g && g<='9'){
  28. x*=10;
  29. x+=g-'0';
  30. if(cnt==0){
  31. fi=g-'0';
  32. }
  33. cnt++;
  34. assert(fi!=0 || cnt==1);
  35. assert(fi!=0 || is_neg==false);
  36.  
  37. assert(!(cnt>19 || ( cnt==19 && fi>1) ));
  38. } else if(g==endd){
  39. if(is_neg){
  40. x= -x;
  41. }
  42.  
  43. if(!(l <= x && x <= r))
  44. {
  45. cerr << l << ' ' << r << ' ' << x << '\n';
  46. assert(1 == 0);
  47. }
  48.  
  49. return x;
  50. } else {
  51. assert(false);
  52. }
  53. }
  54. }
  55. string readString(int l,int r,char endd){
  56. string ret="";
  57. int cnt=0;
  58. while(true){
  59. char g=getchar();
  60. assert(g!=-1);
  61. if(g==endd){
  62. break;
  63. }
  64. cnt++;
  65. ret+=g;
  66. }
  67. assert(l<=cnt && cnt<=r);
  68. return ret;
  69. }
  70. long long readIntSp(long long l,long long r){
  71. return readInt(l,r,' ');
  72. }
  73. long long readIntLn(long long l,long long r){
  74. return readInt(l,r,'\n');
  75. }
  76. string readStringLn(int l,int r){
  77. return readString(l,r,'\n');
  78. }
  79. string readStringSp(int l,int r){
  80. return readString(l,r,' ');
  81. }
  82. void solve()
  83. {
  84. int n=readInt(1,100000,' ');
  85. int x=readInt(1,min(n,26),'\n');
  86. if(n==1)
  87. {
  88. cout<<"a"<<'\n';
  89. return;
  90. }
  91. if(x>((n+1)/2))
  92. {
  93. cout<<-1<<'\n';
  94. return;
  95. }
  96. string tmp="";
  97. for(int i=0;i<x;i++)
  98. tmp+=('a'+i);
  99. while(tmp.length()<n/2)
  100. tmp+=('a'+x-1);
  101. string rev="";
  102. for(int i=0;i<n/2;i++)
  103. rev+=tmp[i];
  104. reverse(all(rev));
  105. if(n%2==1 && tmp.length()<(n+1)/2)
  106. tmp+='a';
  107. tmp+=rev;
  108. cout<<tmp<<'\n';
  109. }
  110. int main()
  111. {
  112. #ifndef ONLINE_JUDGE
  113. freopen("input.txt", "r", stdin);
  114. freopen("output.txt", "w", stdout);
  115. #endif
  116. ios_base::sync_with_stdio(false);
  117. cin.tie(NULL),cout.tie(NULL);
  118. int T=readInt(1,10000,'\n');
  119. while(T--)
  120. solve();
  121. assert(getchar()==-1);
  122. cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
  123. }