#include <bits/stdc++.h>
using namespace std;
int n, m, i, l, r, ansn;
char ans[1000006], temp[1000006];
void update(int t, int b) {
  int len = 1, i, k;
  while (t != b && t >= 0 && b >= 0)
    if (t > b) {
      temp[len++] = 'T';
      t -= b;
    } else {
      temp[len++] = 'B';
      b -= t;
    }
  if (len != n || t != 1) return;
  temp[len] = 'T';
  k = 0;
  for (i = 1; i < len; i++)
    if (temp[i] == temp[i + 1]) k++;
  if (k < ansn) {
    ansn = k;
    for (i = 0; i < len; i++) ans[i] = temp[len - i];
    ans[len] = '\0';
  }
  return;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    int i;
    ansn = 1000000000;
    for (i = 1; i <= m; i++) {
      update(i, m);
      update(m, i);
    }
    if (ansn == 1000000000)
      printf("IMPOSSIBLE\n");
    else
      printf("%d\n%s\n", ansn, ans);
  }
  return 0;
}
