#include <bits/stdc++.h>
using namespace std;
int b, d, is[9];
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int main() {
  scanf("%d%d", &b, &d);
  int k = 0;
  for (; gcd(b, d) > 1; k++) d /= gcd(b, d);
  if (d == 1) {
    printf("2-type\n%d", k);
  } else if (k == 0 && b % d == 1) {
    printf("3-type");
  } else if (k == 0 && b % d == d - 1) {
    printf("11-type");
  } else if ((b * b - 1) / (b % 2 + 1) % d == 0) {
    printf("6-type");
  } else
    printf("7-type");
}
