#include <bits/stdc++.h>
using namespace std;
char s[1001000], a[1001000];
int n, r, x = 100000000;
void run(int t, int b) {
  int v = 0;
  for (int i = n; i-- > 0;) {
    if (t && b && v < x) {
      if (t >= b)
        s[i] = 'T', t -= b;
      else
        s[i] = 'B', b -= t;
      v += s[i] == s[i + 1];
    } else
      return;
  }
  if (0 == t && 1 == b && 'T' == *s && v < x) {
    x = v;
    for (int i = 0; i < n; ++i) a[i] = s[i];
  }
}
int main(void) {
  cin >> n >> r;
  for (int i = 0; i <= r; ++i) run(i, r), run(r, i);
  if (x > n * 2)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << x << endl << a << endl;
  return 0;
}
