#include <bits/stdc++.h>
using namespace std;
int b, d;
bool fun(int d) {
  if ((b - 1) % d == 0 || (b + 1) % d == 0) return true;
  long long x = 1;
  for (int i = 1; i <= 6; ++i) {
    x *= b;
    if (x % d == 0) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &b, &d);
  if ((b - 1) % d == 0) {
    printf("3-type\n");
    return 0;
  }
  long long x = 1;
  for (int i = 1; i <= 6; ++i) {
    x *= b;
    if (x % d == 0) {
      printf("2-type\n%d\n", i);
      return 0;
    }
  }
  if ((b + 1) % d == 0) {
    printf("11-type\n");
    return 0;
  }
  int n = d;
  int flag = 1;
  for (int i = 2; i <= n && flag; ++i)
    if (n % i == 0) {
      int y = 1;
      while (n % i == 0) {
        y *= i;
        n /= i;
      }
      if (!fun(y)) flag = 0;
    }
  if (flag)
    printf("6-type\n");
  else
    printf("7-type\n");
  return 0;
}
