#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
inline int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
inline bool judge(int B, int D) {
  int x = B, y = D, t, cnt = 0;
  while ((t = gcd(x, y)) != 1) y /= t, cnt++;
  if (y == 1)
    return true;
  else if (B % D == 1)
    return true;
  else if (B % D == D - 1)
    return true;
  return false;
}
vector<int> fac2;
int main() {
  int B, D;
  scanf("%d%d", &B, &D);
  int r = D;
  for (int i = 2; i < r; i++)
    if (r % i == 0) fac2.push_back(i);
  int x = B, y = D, t, cnt = 0;
  while ((t = gcd(x, y)) != 1) y /= t, cnt++;
  if (y == 1) {
    printf("2-type\n%d\n", cnt);
    return 0;
  } else if (B % D == 1) {
    puts("3-type");
    return 0;
  } else if (B % D == D - 1) {
    puts("11-type");
    return 0;
  } else if ((B * B - 1) / (B % 2 + 1) % y == 0) {
    puts("6-type");
    return 0;
  }
  puts("7-type");
}
