#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  __print(x.first);
  cout << ',';
  __print(x.second);
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const int N = 3e5 + 7;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t, a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    long long temp = sqrt((b - 1) * 2) + 1;
    long long temp2 = ((temp - 1) * (temp)) / 2 + 1;
    if (temp2 > b) {
      temp--;
      temp2 = ((temp - 1) * (temp)) / 2 + 1;
    }
    long long len = 0;
    for (int i = 0; i < a - (temp + 1); i++) cout << 'a', len++;
    cout << 'b';
    len++;
    for (int i = 0; i < (temp - 1) - (b - temp2); i++) cout << 'a', len++;
    cout << 'b';
    len++;
    for (int i = 0; i < a - len; i++) cout << 'a';
    cout << '\n';
  }
  return 0;
}
