#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000000009;
const int NMAX = 1000006;
int ans = INF;
char s[NMAX], t[NMAX];
void calc(int a, int b, int n) {
  int cur = 0;
  while (a >= 1 && b >= 1) {
    if (a > b) {
      a -= b;
      s[cur++] = 'T';
    } else if (b > a) {
      b -= a;
      s[cur++] = 'B';
    } else if (a == b) {
      if (a > 1) return;
      s[cur++] = 'T';
      break;
    }
  }
  if (cur == n - 1) {
    int mist = 0;
    for (int i = 0; i < int(cur - 1); i++) {
      if (s[i] == s[i + 1]) mist++;
    }
    if (mist < ans) {
      ans = mist;
      for (int i = 0; i < int(cur); i++) t[i] = s[i];
    }
  }
}
int main() {
  int n, r;
  cin >> n >> r;
  if (n == 1 && r == 1) {
    cout << "0\nT\n" << endl;
    return 0;
  }
  for (int a = 1; a <= r - 1; a++) {
    calc(a, r - a, n);
  }
  if (ans == INF) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  cout << ans << endl;
  reverse(t, t + n - 1);
  if (t[n - 2] == 'T')
    t[n - 1] = 'B';
  else
    t[n - 1] = 'T';
  t[n] = 0;
  puts(t);
  return 0;
}
