#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, ans;
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 check(int m) {
  int ans = 1;
  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
        return 0;
  return ans;
}
int main() {
  scanf("%d%d", &n, &m);
  if (ans = check(m)) {
    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 && gcd(j, m / j) == 1 && check(j))
      for (int i = 1; i <= m / j; i++)
        if (m % i == 0 && gcd(i, m / j / i) == 1 && (n - 1) % i == 0 &&
            (n + 1) % (m / j / i) == 0) {
          printf("6-type\n");
          return 0;
        }
  printf("7-type\n");
  return 0;
}
