#include <bits/stdc++.h>
using namespace std;
int n, r;
int nres;
string res;
char op[2000000];
int cal(int, int);
int main() {
  cin >> n >> r;
  if (r == 1 && n != 1) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  } else if (r == 1 && n == 1) {
    cout << 0 << endl;
    cout << "T" << endl;
    return 0;
  }
  int ii = -1;
  nres = 1000000000;
  for (int i = 1; i <= r - 1; i++) {
    int c = cal(i, r);
    if (c != -1 && c < nres) {
      nres = c;
      ii = i;
    }
  }
  if (ii == -1) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  int x = ii;
  int y = r;
  int last = 2;
  int len = 0;
  while (x != y) {
    if (x > y) {
      x = x - y;
      op[len++] = 'T';
    } else {
      y = y - x;
      op[len++] = 'B';
    }
  }
  cout << nres << endl;
  if (op[len - 1] == 'T') {
    for (int i = 0; i < len; i++)
      if (op[i] == 'T')
        op[i] = 'B';
      else
        op[i] = 'T';
  }
  op[len++] = 'T';
  for (int i = len - 1; i >= 0; i--) cout << op[i];
  cout << endl;
  return 0;
}
int cal(int x, int y) {
  int wrong = 0;
  int last = 1;
  int c = 0;
  int xx = x;
  int yy = y;
  if (x == y - 1 && x + 1 == n) return x - 2;
  while (x != y) {
    if (x > y) {
      x = x - y;
      if (last == 1) wrong++;
      last = 1;
    } else {
      y = y - x;
      if (last == 2) wrong++;
      last = 2;
    }
    c++;
    if (c >= n) return -1;
  }
  c++;
  if (c != n) return -1;
  if (x != 1) return -1;
  return wrong;
}
