#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  long long m, n, i, j, k, l, t;
  cin >> t;
  vector<long long> v(200000);
  for (i = 1; i < 200000; i++) {
    v[i] = i * (i + 1) / 2;
  }
  while (t--) {
    cin >> n >> k;
    int a = n - 2, b = n - 1;
    auto it = lower_bound((v).begin(), (v).end(), k);
    int x = it - v.begin();
    if (v[x] == k) {
      a -= (x - 1);
      b -= (x - 1);
    } else {
      a -= (x - 1);
      b -= (k - v[x - 1] - 1);
    }
    for (i = 0; i < n; i++) {
      if (i == a || i == b)
        cout << "b";
      else
        cout << "a";
    }
    cout << "\n";
  }
}
