#include <bits/stdc++.h>
using namespace std;
int n;
char op[1000005];
char ans[1000005];
int minv;
void solve(int t, int b) {
  int i;
  for (i = n - 1; t * b != 0 && i >= 0; --i) {
    if (t >= b) {
      t -= b;
      op[i] = 'T';
    } else {
      b -= t;
      op[i] = 'B';
    }
  }
  if (i != -1 || t != 0 || b != 1) return;
  int cnt = 0;
  for (i = 1; i < n; ++i) {
    if (op[i] == op[i - 1]) cnt++;
  }
  if (cnt < minv) {
    minv = cnt;
    strcpy(ans, op);
  }
}
int main() {
  int r, i, j;
  scanf("%d %d", &n, &r);
  op[n] = '\0';
  minv = 2147483647;
  for (i = 0; i <= r; ++i) {
    solve(i, r);
    solve(r, i);
  }
  if (minv == 2147483647)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n%s\n", minv, ans);
  }
  return 0;
}
