#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
int n;
int m;
int main() {
  int last;
  cin >> n >> last;
  if (n == 1) {
    if (last == 1) {
      cout << 0 << endl << "T" << endl;
    } else {
      cout << "IMPOSSIBLE" << endl;
    }
    return 0;
  }
  int ans = -1;
  int errans = 1e9;
  for (int i = 1; i <= last; i++) {
    int a = last, b = i;
    int err = 0, len = 0;
    while (b) {
      err += (a / b) - 1;
      len += a / b;
      a %= b;
      swap(b, a);
    }
    if (a != 1) continue;
    err--;
    if (len == n) {
      if (errans > err) {
        errans = err;
        ans = i;
      }
    }
  }
  if (ans < 0) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  vector<int> res;
  int a = last, b = ans;
  while (b) {
    res.push_back(a / b);
    a %= b;
    swap(b, a);
  }
  reverse((res).begin(), (res).end());
  res[0]--;
  cout << errans << endl;
  cout << "T";
  for (int i = 0; i < (((int)(res).size())); i++)
    for (int j = 0; j < (res[i]); j++) printf("%c", ((i + 1) % 2 ? 'B' : 'T'));
  printf("\n");
  return 0;
}
