#include <bits/stdc++.h>
using namespace std;
struct May {
  int len, time, k;
  void update(const May &a, int n) {
    if (a.len == n && (len == 0 || a.time < time)) {
      len = a.len, time = a.time, k = a.k;
    }
  }
} ans;
bool check(May &may, int k, int r) {
  may.k = k;
  may.len = 0, may.time = 0;
  while (k) {
    if (k > r) {
      k ^= r ^= k ^= r;
      continue;
    }
    may.len += r / k;
    if (k == 1)
      may.time += max(r / k - 2, 0);
    else
      may.time += r / k - 1;
    r %= k;
  }
  return r == 1;
}
int stk[1000010], top;
int main() {
  int n, r;
  May may;
  cin >> n >> r;
  if (n == 1) {
    if (r == 1) {
      cout << "0" << endl << 'T' << endl;
    } else {
      cout << "IMPOSSIBLE" << endl;
    }
    return 0;
  }
  for (int i = 1; i < r; ++i) {
    if (check(may, i, r)) {
      ans.update(may, n);
    }
  }
  if (ans.len == 0) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    while (ans.k) {
      if (ans.k > r) {
        ans.k ^= r ^= ans.k ^= r;
        continue;
      }
      stk[++top] = r / ans.k;
      r %= ans.k;
    }
    cout << ans.time << endl;
    char now;
    cout << "TB";
    stk[top] -= 2;
    now = (stk[top] ? 'B' : 'T');
    while (top) {
      if (stk[top]) {
        for (int i = 0; i < stk[top]; ++i) {
          cout << now;
        }
        now = (now == 'T' ? 'B' : 'T');
      }
      --top;
    }
    cout << endl;
  }
  return 0;
}
