#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    long long l = 0, r = k + 1;
    while (r - l > 1) {
      long long mid = (l + r) / 2;
      if ((mid * (mid + 1)) / 2 < k)
        l = mid;
      else
        r = mid;
    }
    long long s = k - ((l * (l + 1)) / 2);
    if (s != 0) l++;
    for (int i = 0; i < n; i++) {
      if (i == n - l - 1 || i == n - s)
        cout << 'b';
      else
        cout << 'a';
    }
    cout << endl;
  }
  return 0;
}
