#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int a, b;
    cin >> a >> b;
    int sum = 0;
    int h;
    for (int i = 1; i < a; i++) {
      sum += i;
      if (sum >= b) {
        sum -= i;
        h = i - 1;
        break;
      }
    }
    int s = a - h - 1;
    int sb = a - (b - sum) + 1;
    for (int i = 1; i <= a; i++) {
      if (i == s || i == sb)
        cout << "b";
      else
        cout << "a";
    }
    cout << endl;
  }
  return 0;
}
