#include <bits/stdc++.h>
using namespace std;
int b, d;
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
bool pd2(int x, int y, int &num) {
  for (int k = gcd(x, y); k != 1; k = gcd(x, y)) y /= k, ++num;
  return y == 1;
}
bool pd3(int x, int y) { return x % y == 1; }
bool pd11(int x, int y) { return (x + 1) % y == 0; }
bool pd6(int x, int y) {
  for (int i = 2; i <= 100; i++) {
    while (y % i == 0) {
      int j = 1, num;
      while (y % i == 0) y /= i, j *= i;
      if (!pd2(x, j, num) && !pd3(x, j) && !pd11(x, j)) return 0;
    }
  }
  return 1;
}
int main() {
  scanf("%d%d", &b, &d);
  int num = 0;
  if (pd2(b, d, num))
    printf("2-type\n%d\n", num);
  else if (pd3(b, d))
    printf("3-type\n");
  else if (pd11(b, d))
    printf("11-type\n");
  else if (pd6(b, d))
    printf("6-type\n");
  else
    printf("7-type\n");
}
