#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int pos1, pos2;
    long long int n, k;
    cin >> n >> k;
    char ans[n];
    for (long long int i = 1; i < n; i++) {
      long long int probable = i * (i + 1) / 2;
      if (probable >= k) {
        pos1 = i;
        break;
      }
    }
    pos2 = -pos1 * (pos1 - 1) / 2 + k - 1;
    for (long long int i = n - 1; i > -1; i--) {
      if (i == pos1 || i == pos2) {
        ans[i] = 'b';
      } else {
        ans[i] = 'a';
      }
    }
    for (long long int i = n - 1; i > -1; i--) {
      cout << ans[i];
    }
    cout << '\n';
  }
}
