#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
char ans[1000010];
char tmp[1000010];
int n, r;
int maxm;
void gao(int x, int y) {
  int len = 0;
  while (x != y) {
    if (x > y) {
      x -= y;
      tmp[len++] = 'T';
    } else {
      y -= x;
      tmp[len++] = 'B';
    }
  }
  if (x > 1) return;
  tmp[len++] = 'T';
  if (len != n) return;
  reverse(tmp, tmp + len);
  int cc = 0, i;
  for (i = 1; i < len; i++) {
    if (tmp[i - 1] == tmp[i]) cc++;
  }
  if (maxm > cc) {
    maxm = cc;
    for (i = 0; i < len; i++) {
      ans[i] = tmp[i];
    }
  }
}
int main() {
  cin >> n >> r;
  int i;
  maxm = (1 << 30);
  for (i = 1; i <= r; i++) {
    if (gcd(i, r) != 1) continue;
    gao(i, r);
    gao(r, i);
  }
  if (maxm == (1 << 30))
    cout << "IMPOSSIBLE" << endl;
  else {
    cout << maxm << endl;
    ans[n] = '\0';
    cout << ans << endl;
  }
  return 0;
}
