#include <bits/stdc++.h>
const long long int mod = 1000000007;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k, lo, hi, pos1, pos2, rem, mid, i, mn;
    cin >> n >> k;
    k--;
    lo = 0;
    hi = n;
    mn = n + 1;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if ((mid * (mid + 3)) / 2 >= k) {
        mn = min(mn, mid);
        hi = mid - 1;
      } else
        lo = mid + 1;
    }
    pos1 = n - 2 - mn;
    k -= ((mn - 1) * (mn + 2)) / 2 + 1;
    pos2 = n - 1 - k;
    for (i = 0; i < n; i++) {
      if (i == pos1 || i == pos2)
        cout << 'b';
      else
        cout << 'a';
    }
    cout << "\n";
  }
  return 0;
}
