#include <bits/stdc++.h>
using namespace std;
inline void debug() { freopen("inp.txt", "r", stdin); }
long long bin_search(long long left, long long right, long long k) {
  long long mid, ret;
  while (left <= right) {
    mid = (left + right) / 2;
    if (mid * (mid + 1) / 2 < k) {
      ret = mid;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  return ret;
}
inline void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  long long sum = 1, a = 1;
  while (sum <= k) {
    sum += a;
    a++;
  }
  a--;
  long long f = k - (sum - a);
  for (long long i = 0 + 0; i < n; i++) {
    if (i == f || (i == a))
      s += 'b';
    else
      s += 'a';
  }
  reverse(s.begin(), s.end());
  cout << s << endl;
  return;
}
signed main() {
  long long t;
  cin >> t;
  for (long long i = 0 + 0; i < t; i++) solve();
  return 0;
}
