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