#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n, k;
    cin >> n >> k;
    int x = k;
    int a = n - 2;
    int b = 2;
    int y = 0, z = 0;
    string s = "";
    while (x > 0) {
      a--;
      long long int ans;
      if (b == 2) ans = (long long int)(a + 2) * (a + 1) / 2;
      if (b == 1) ans = a + 1;
      if (b == 0) ans = 1;
      if (x > ans) {
        x = x - ans;
        s += 'b';
        a++;
        b--;
      } else if (ans == x) {
        s += 'a';
        for (int i = 0; i < b; i++) s += 'b';
        for (int i = 0; i < a; i++) s += 'a';
        x = x - ans;
      } else {
        s += 'a';
      }
    }
    cout << s << endl;
  }
  return 0;
}
