#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
  x = 0;
  int ch = getchar(), f = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  if (f) x = -x;
}
const int inf = 0x3f3f3f3f;
long long T, n, k;
int main() {
  cin >> T;
  while (T--) {
    cin >> n >> k;
    long long temp = 1;
    while (temp * (temp + 1) / 2 < k) temp++;
    int idx = n - temp;
    long long rest = temp * (temp + 1) / 2 - k + 1;
    for (auto i = (1); i <= (idx - 1); ++i) printf("a");
    printf("b");
    for (auto i = (idx + 1); i <= (n); ++i) {
      if (i == idx + rest)
        printf("b");
      else
        printf("a");
    }
    cout << endl;
  }
  return 0;
}
