#include <bits/stdc++.h>
using namespace std;
long n, r;
long m = 10000000;
char* cur;
char* m_s;
void go(long a1, long a2) {
  long k = n - 1;
  string moves = "";
  while (k > 0 && (a1 > 0 && a2 > 0)) {
    if (a1 > a2) {
      a1 -= a2;
      cur[k] = 'T';
    } else {
      a2 -= a1;
      cur[k] = 'B';
    }
    k--;
  }
  if (k != 0 || a1 != 1 || a2 != 1) return;
  long mist = 0;
  for (long i = 0; i < n - 1; i++) {
    if (cur[i] == cur[i + 1]) mist++;
  }
  if (mist < m) {
    m = mist;
    memcpy(m_s, cur, n + 1);
  }
}
int main() {
  cin >> n >> r;
  m_s = new char[n + 1];
  cur = new char[n + 1];
  cur[n] = 0;
  cur[0] = 'T';
  for (int i = 1; i <= r; i++) {
    go(i, r);
    go(r, i);
  }
  if (m != 10000000) {
    cout << m << endl;
    cout << m_s << endl;
  } else
    cout << "IMPOSSIBLE" << endl;
}
