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