#include <bits/stdc++.h>
using namespace std;
const int mn = INT_MIN;
const int mx = INT_MAX;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int o = 0, t = 1;
    int r = 0;
    while (r + t < k) {
      r += t;
      t++;
    }
    for (auto i = r + 2; i < int(k + 1); i++) {
      if (o + 1 < t) {
        o++;
      } else {
        t++;
        o = 0;
      }
    }
    for (auto j = 0; j < int(n); j++) {
      int i = n - j - 1;
      if (i == o || i == t) {
        cout << 'b';
      } else
        cout << 'a';
    }
    cout << "\n";
  }
}
