#include <bits/stdc++.h>
using namespace std;
int pri[26] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29, 31, 37, 41,
               43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int n, m;
int Get(int x, int y) {
  int d = 0;
  for (; x % y == 0; d++, x /= y)
    ;
  return d;
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  scanf("%d%d", &n, &m);
  int ans = 0;
  for (int i = 0; i < 26; i++)
    if (m % pri[i] == 0)
      if (n % pri[i] == 0)
        ans = max(ans, (Get(m, pri[i]) - 1) / Get(n, pri[i]) + 1);
      else {
        ans = 0;
        break;
      }
  if (ans) {
    printf("2-type\n%d\n", ans);
    return 0;
  }
  if ((n - 1) % m == 0) {
    printf("3-type\n");
    return 0;
  }
  if ((n + 1) % m == 0) {
    printf("11-type\n");
    return 0;
  }
  for (int j = 1; j <= m; j++)
    if (m % j == 0) {
      ans = 1;
      for (int i = 0; i < 26; i++)
        if (j % pri[i] == 0)
          if (n % pri[i] == 0)
            ans = max(ans, (Get(j, pri[i]) - 1) / Get(n, pri[i]) + 1);
          else {
            ans = 0;
            break;
          }
      for (int i = 1; i <= m / j && ans; i++)
        if (m % i == 0)
          if (gcd(i, j) == 1 && gcd(i, m / j / i) == 1 &&
              gcd(j, m / j / i) == 1)
            if ((n - 1) % i == 0 && (n + 1) % (m / j / i) == 0) {
              printf("6-type\n");
              return 0;
            }
    }
  printf("7-type\n");
  return 0;
}
