#include <bits/stdc++.h>
using namespace std;
int n, r, ans, step[1000010], c[1000010];
void solve() {
  int a, b, jilu, same, p;
  for (int i = r; i >= 1; i--) {
    p = n - 1;
    a = r;
    b = i;
    jilu = 0;
    same = 0;
    step[0] = 0;
    while (a > 0 && b > 0 && p > 0) {
      p--;
      if (a > b) {
        a = a - b;
        step[++jilu] = 1;
      } else {
        b = b - a;
        step[++jilu] = 2;
      }
      if (step[jilu] == step[jilu - 1]) same++;
      if (a == 1 && b == 1 && p == 0) {
        if (same < ans) {
          ans = same;
          if (step[jilu] == 1) {
            for (int j = 1; j <= jilu; j++) c[j] = 3 - step[j];
          } else {
            for (int j = 1; j <= jilu; j++) c[j] = step[j];
          }
        }
      }
      if (same >= ans) break;
    }
  }
}
int main() {
  scanf("%d%d", &n, &r);
  ans = 1999999999;
  if (n == 1 && r == 1) {
    printf("0\n");
    printf("T\n");
  } else {
    solve();
    if (ans == 1999999999)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\n", ans);
      c[n] = 1;
      for (int i = n; i >= 1; i--)
        if (c[i] == 1)
          printf("T");
        else if (c[i] == 2)
          printf("B");
      printf("\n");
    }
  }
}
