#include <bits/stdc++.h>
using namespace std;
int seq[1000010], ans[1000010];
int main() {
  int n, r, bst = 999999999;
  scanf("%d%d", &n, &r);
  for (int i = r; i >= 1; i--) {
    int x = i, y = r, p = n - 1, c = 0, cnt = 0;
    while (x > 0 && y > 0 && p > 0) {
      if (x > y)
        x = x - y, seq[++c] = 1;
      else
        y = y - x, seq[++c] = 2;
      if (seq[c] == seq[c - 1]) cnt++;
      p--;
    }
    if (x == 1 && y == 1 && bst > cnt) {
      for (int j = 1; j <= c; j++) ans[j] = seq[c] == 2 ? seq[j] : 3 - seq[j];
      bst = cnt;
      ans[c + 1] = 1;
    }
  }
  if (bst == 999999999) {
    puts("IMPOSSIBLE");
    return 0;
  }
  printf("%d\n", bst);
  for (int i = n; i >= 1; i--) printf(ans[i] == 1 ? "T" : "B");
}
