#include <bits/stdc++.h>
using namespace std;
const int mx = 1000005;
const int inf = 0x3f3f3f3f;
int t, n, r, ans;
char a[mx], c[mx];
void solve(int t, int b) {
  int j = 1;
  while (t != b && t >= 0 && b >= 0) {
    if (t > b) {
      c[j++] = 'T';
      t -= b;
    } else {
      c[j++] = 'B';
      b -= t;
    }
  }
  if (j != n || t != 1) return;
  c[n] = 'T';
  int sum = 0;
  for (int i = 0; i < n; i++)
    if (c[i] == c[i + 1]) sum++;
  if (sum < ans) {
    ans = sum;
    for (int i = 0; i < n; i++) {
      a[i] = c[n - i];
    }
    a[n] = '\n';
  }
}
int main() {
  while (scanf("%d%d", &n, &r) != EOF) {
    ans = inf;
    for (int i = 1; i <= r; i++) {
      solve(i, r);
      solve(r, i);
    }
    if (ans == inf)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\n", ans);
      for (int i = 0; i < n; i++) printf("%c", a[i]);
      puts("");
    }
  }
  return 0;
}
