#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int oo = 2100000000;
const int Max = 1000005;
int n, r;
char ans2[Max], tmp[Max];
int ans1;
void solve(int x, int y) {
  for (int i = n - 1; i > 0; i--) {
    if (x >= y) {
      tmp[i] = 'T';
      x -= y;
    } else {
      tmp[i] = 'B';
      y -= x;
    }
    if (x <= 0 || y <= 0) return;
  }
  if (x == 1 && y == 1) {
    int num = 0;
    tmp[0] = 'T';
    tmp[n] = '\0';
    for (int i = 0; i < n - 1; i++)
      if (tmp[i] == tmp[i + 1]) num++;
    if (num < ans1) {
      ans1 = num;
      for (int i = 0; i < n; i++) ans2[i] = tmp[i];
    }
  }
  return;
}
int main() {
  while (scanf("%d %d", &n, &r) == 2) {
    ans1 = oo;
    for (int i = 1; i <= r; i++) {
      solve(i, r);
      solve(r, i);
    }
    if (ans1 == oo)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\n", ans1);
      printf("%s\n", ans2);
    }
  }
  return (0);
}
