#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr ll mod = 1e9 + 7;
void solve() {
  int n, k;
  cin >> n >> k;
  string ans(n, 'a');
  int sum = 0;
  for (int(i) = (n - 2); (i) >= 0; --(i)) {
    if (sum + n - i - 1 >= k) {
      ans[i] = 'b';
      ans[n - (k - sum)] = 'b';
      cout << ans << endl;
      return;
    } else {
      sum += n - i - 1;
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
