#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') positive = 0;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  int b = read(), d = read(), ans, tmp = d;
  long long now = 1;
  for (int i = 1; i <= 7; ++i) {
    now = now * b;
    if (now % tmp == 0) {
      printf("2-type\n%d\n", i);
      return 0;
    }
  }
  if ((b - 1) % d == 0) return printf("3-type\n"), 0;
  if ((b + 1) % d == 0) return printf("11-type\n"), 0;
  for (int i = 2; i <= d; ++i)
    if (d % i == 0) {
      if (b % i == 0) {
        while (d % i == 0) d /= i;
        if (ans == -1)
          ans = 2;
        else if (ans != 2)
          ans = 6;
      }
    }
  int x = (b + 1) * (b - 1) / gcd(b + 1, b - 1);
  if (x % d == 0)
    printf("6-type\n");
  else
    printf("7-type\n");
  return 0;
}
