#include <bits/stdc++.h>
int f[100] = {0, 1};
int is[1000001] = {0, 1};
char ans[1000001], tmp[1000001];
void cal() {
  int n = 2;
  while (1) {
    f[n] = f[n - 1] + f[n - 2];
    if (f[n] > 1000000) break;
    is[f[n]] = n;
    n++;
  }
}
int main() {
  int n, r, i, j, a, b;
  scanf("%d%d", &n, &r);
  if (r == 1) {
    if (n == 1)
      printf("0\nT\n");
    else
      printf("IMPOSSIBLE\n");
    return 0;
  }
  if (n == 1) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  cal();
  if (is[r]) {
    printf("0\n");
    for (i = 0; i < is[r] - 1; i++)
      if (i & 1)
        printf("B");
      else
        printf("T");
    printf("\n");
  } else {
    int num = 10000000, k, count, flag = 0;
    for (i = r / 2; i >= 0; i--) {
      k = 0;
      count = 0;
      if (r % 2 == 0 && i % 2 == 0) continue;
      a = i;
      b = r - i;
      while (a != 1 || b != 1) {
        if (a < b) {
          b -= a;
          if (k > 0 && tmp[k - 1] == 'B') count++;
          tmp[k++] = 'B';
        } else if (a > b) {
          a -= b;
          if (k > 0 && tmp[k - 1] == 'T') count++;
          tmp[k++] = 'T';
        } else {
          if (a != 1 || b != 1) break;
        }
        if (count > num || k >= n - 2) break;
      }
      tmp[k] = 0;
      if (a != 1 || b != 1 || k == 0 || k != n - 2) continue;
      if (count < num) {
        num = count;
        strcpy(ans, tmp);
      }
    }
    if (num == 10000000)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\nT", num);
      int len = strlen(ans);
      if (ans[len - 1] == 'T') flag = 1;
      for (i = len - 1; i >= 0; i--) {
        if (flag) {
          if (ans[i] == 'T')
            printf("B");
          else
            printf("T");
        } else
          printf("%c", ans[i]);
      }
      if (flag)
        printf("%c\n", ans[0]);
      else {
        if (ans[0] == 'T')
          printf("B\n");
        else
          printf("T\n");
      }
    }
  }
  return 0;
}
