#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
int ans = inf;
char s[1000005], str[1000005];
int n, r;
void check(int t, int d) {
  int len = 0;
  while (t != d && t > 0 && d > 0) {
    if (t > d) {
      s[len++] = 'T';
      t -= d;
    } else {
      s[len++] = 'B';
      d -= t;
    }
  }
  s[len] = 'T';
  if (len != n - 1 || t != 1) return;
  int cnt = 0;
  for (int i = 0; i < len; i++) {
    if (s[i] == s[i + 1]) cnt++;
  }
  if (cnt < ans) {
    ans = cnt;
    for (int i = 0; i <= len; i++) {
      str[i] = s[len - i];
    }
    str[len + 1] = '\0';
  }
}
int main() {
  scanf("%d%d", &n, &r);
  for (int i = 1; i <= r; i++) {
    check(i, r);
    check(r, i);
  }
  if (ans == inf)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans);
    printf("%s\n", str);
  }
  return 0;
}
