#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using std::bitset;
using namespace std;
int a[1001000], ans[1001000];
int n, r, len, mlen;
void process() {
  int i, j, tem, x, y, s, t;
  for (i = r; i > 0; i--) {
    len = s = 0;
    t = n - 1;
    x = r;
    y = i;
    while (x > 0 && y > 0 && t > 0) {
      t--;
      if (x > y) {
        x -= y;
        a[++len] = 2;
      } else {
        y -= x;
        a[++len] = 1;
      }
      if (a[len] == a[len - 1]) s++;
    }
    if (x == 1 && y == 1)
      if (s < mlen) {
        mlen = s;
        if (a[len] == 2) {
          for (j = 1; j <= len; j++) ans[j] = a[j];
          ans[len + 1] = 1;
        } else {
          for (j = 1; j <= len; j++) ans[j] = 3 - a[j];
          ans[len + 1] = 1;
        }
      }
  }
}
int main() {
  int i, j, tem;
  while (scanf("%d%d", &n, &r) != EOF) {
    mlen = 0x3f3f3f3f;
    process();
    if (mlen == 0x3f3f3f3f)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\n", mlen);
      for (i = len + 1; i > 0; i--)
        if (ans[i] == 2)
          putchar('B');
        else
          putchar('T');
    }
  }
  return 0;
}
