#include <bits/stdc++.h>
using namespace std;
int b, d;
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> b >> d;
  int cnt = 0;
  for (int g = gcd(b, d); g > 1; d /= g, g = gcd(b, d), ++cnt)
    ;
  if (d == 1)
    printf("2-type\n%d\n", cnt);
  else if (!cnt && b % d == 1)
    puts("3-type");
  else if (!cnt && b % d == d - 1)
    puts("11-type");
  else if ((b + 1) * (b - 1) / ((b % 2) + 1) % d == 0)
    puts("6-type");
  else
    puts("7-type");
  fclose(stdin);
  fclose(stdout);
  return 0;
}
