#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 1e6;
const double eps = 1e-9;
const double pi = acos(-1);
using namespace std;
char ans[maxn], tmp[maxn];
int n, m, num = inf;
void work(int t, int b) {
  int len = 1, cnt = 0;
  while (t >= 0 && b >= 0 && t != b) {
    if (t > b) {
      t -= b;
      tmp[len++] = 'T';
    } else {
      b -= t;
      tmp[len++] = 'B';
    }
  }
  if (len != m || b != 1) return;
  tmp[len] = 'T';
  for (int i = 1; i < len; i++) {
    if (tmp[i] == tmp[i + 1]) cnt++;
  }
  if (cnt < num) {
    num = cnt;
    for (int i = 0; i < len; i++) {
      ans[i] = tmp[len - i];
    }
    ans[len] = 0;
  }
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= n; i++) {
    work(i, n);
    work(n, i);
  }
  if (num == inf) {
    puts("IMPOSSIBLE");
    return 0;
  }
  printf("%d\n%s\n", num, ans);
  return 0;
}
