#include <bits/stdc++.h>
using namespace std;
int n, m, s;
int gcd(int a, int b) {
  int t;
  while (b != 0) {
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int main() {
  scanf("%d%d", &n, &m);
  while (gcd(n, m) > 1) m /= gcd(n, m), s++;
  if (m == 1)
    printf("2-type\n%d\n", s);
  else {
    if ((n - 1) * (n + 1) / gcd(n - 1, n + 1) % m == 0) {
      if (!s && (n - 1) % m == 0)
        puts("3-type");
      else if (!s && (n + 1) % m == 0)
        puts("11-type");
      else
        puts("6-type");
    } else
      puts("7-type");
  }
  return 0;
}
