#include <bits/stdc++.h>
using namespace std;
long long t, n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> k;
    long long lo = 0, hi = n, ans;
    while (lo <= hi) {
      long long mid = (lo + hi) / 2;
      long long x = mid * (mid + 1);
      x /= 2;
      if (k > x) {
        ans = mid;
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    long long f = ans;
    long long s = k - 1 - ((f * (f + 1)) / 2);
    long long fb = n - 1 - f, sb = n - s;
    for (long long i = 1; i <= n; i++) {
      if (i == fb or i == sb)
        cout << 'b';
      else
        cout << 'a';
    }
    cout << endl;
  }
  return 0;
}
