#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 500100, mod = 998244353;
int t, n, k;
void fn() {
  cin >> n >> k;
  int ans = 0;
  string second(n, 'a');
  for (int i = n - 2; i >= 0; i--) {
    if (k > ans + n - 1 - i) {
      ans += n - 1 - i;
    } else {
      int j = n;
      while (ans < k) {
        ans++;
        j--;
      }
      second[i] = 'b', second[j] = 'b';
      cout << second << endl;
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> t;
  while (t--) fn();
  return 0;
}
