#include <bits/stdc++.h>
using namespace std;
int INF = 999999999;
double EPSILON = 0.00000001;
int check(int r, int dif, int req) {
  int n = 0;
  int changes = 0;
  while (r > 1) {
    changes++;
    int k = (r - dif) / dif;
    n += k;
    r -= k * dif;
    if (r != 1 and r == dif) return -1;
    dif = r - dif;
  }
  if (n + 1 != req) return -1;
  return changes;
}
int main() {
  int n, r;
  cin >> n >> r;
  if (n == 1) {
    if (r == 1)
      cout << "0\nT\n";
    else
      cout << "IMPOSSIBLE\n";
    return 0;
  }
  if (n == 2) {
    if (r == 2)
      cout << "0\nTB\n";
    else
      cout << "IMPOSSIBLE\n";
    return 0;
  }
  int dif;
  int best = 0, ans = -1;
  for (dif = 1; 2 * dif < r; dif++) {
    int x = check(r, dif, n);
    if (x != -1) {
      if (x > best) {
        best = x;
        ans = dif;
      }
    }
  }
  if (ans == -1) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  vector<int> difa;
  dif = ans;
  while (r > 1) {
    int k = (r - dif) / dif;
    for (int _ = 0; _ < k; _++) difa.push_back(dif);
    r -= k * dif;
    dif = r - dif;
  }
  string res = "T";
  string a = "B", b = "T";
  for (int i = difa.size() - 1; i >= 1; i--) {
    if (difa[i - 1] != difa[i]) swap(a, b);
    res += a;
  }
  if (res[res.size() - 1] == 'T')
    res += 'B';
  else
    res += 'T';
  ans = 0;
  for (int i = 0; i < res.size() - 1; i++)
    if (res[i] == res[i + 1]) ans++;
  cout << ans << endl;
  cout << res << endl;
  return 0;
}
