#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int mod = (int)1e9 + 7;
const long long INF = 10000005;
const int N = 1000005;
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) < (cur - 1); ++(i)) {
      if (s[i] == s[i + 1]) mist++;
    }
    if (mist < ans) {
      ans = mist;
      for (int(i) = 0; (i) < (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';
  puts(t);
  return 0;
}
