#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
char str[maxn];
int main() {
  int n;
  while (cin >> n) {
    while (n--) {
      int a, k;
      cin >> a >> k;
      long long pos = a;
      for (long long i = 1; i <= a; i++) {
        if ((i * (i - 1)) / 2 >= k) {
          pos = i;
          break;
        }
      }
      int offset = (pos - 1) * pos / 2 - k;
      int fst = pos;
      int sec = pos - offset - 1;
      for (int i = 0; i < a; i++) {
        if (i == (a - fst) || i == (a - sec)) {
          cout << "b";
        } else {
          cout << "a";
        }
      }
      cout << endl;
    }
  }
}
