#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T, class S>
ostream &operator<<(ostream &o, const pair<T, S> &p) {
  return o << '(' << p.first << ", " << p.second << ')';
}
template <template <class, class...> class T, class... A>
typename enable_if<!is_same<T<A...>, string>(), ostream &>::type operator<<(
    ostream &o, T<A...> V) {
  o << '[';
  for (auto a : V) o << a << ", ";
  return o << ']';
}
void print(long long int n, long long int k) {
  long long int r = (n - 1) * (n - 2) / 2;
  if (k < r)
    cout << 'a', print(n - 1, k);
  else {
    cout << 'b';
    long long int q = n * (n - 1) / 2 - k - 1;
    for (long long int i = 0; i < q; i++) cout << 'a';
    cout << 'b';
    for (long long int i = 0; i < n - 2 - q; i++) cout << 'a';
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int tc;
  cin >> tc;
  while (tc--) {
    long long int n;
    cin >> n;
    long long int k;
    cin >> k;
    print(n, k - 1);
  }
}
