#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
bool a2, a3, a11;
int n, m;
int d;
bool prime[MAXN];
int x[MAXN], y[MAXN];
int lcm(int x, int y) {
  for (int i = 1;; i++)
    if (i % x == 0 && i % y == 0) return i;
}
int main() {
  cin >> n >> m;
  for (int i = 2; i <= max(n, m); i++) prime[i] = true;
  for (int i = 2; i <= max(n, m); i++) {
    for (int j = i + i; j <= max(n, m); j += i) prime[j] = false;
  }
  int tm = m;
  for (int i = 2; i <= tm; i++)
    if (prime[i] && tm % i == 0) x[i]++, tm /= i, i--;
  int tn = n;
  for (int i = 2; i <= tn; i++)
    if (prime[i] && tn % i == 0) y[i]++, tn /= i, i--;
  for (int i = 2; i <= m; i++)
    if (prime[i] && x[i] != 0 && n % i == 0) {
      a2 = true;
      if ((x[i] - 1) / y[i] + 1 > d) d = (x[i] - 1) / y[i] + 1;
      for (int j = 1; j <= x[i]; j++) m /= i;
    }
  if (m != 1 && (n - 1) % m == 0)
    a3 = true;
  else if (m != 1 && (n + 1) % m == 0)
    a11 = true;
  else if (m != 1 && lcm(n - 1, n + 1) % m == 0)
    a3 = a11 = true;
  else if (m != 1) {
    printf("7-type\n");
    return 0;
  }
  if ((int)a2 + (int)a3 + (int)a11 >= 2)
    printf("6-type\n");
  else if (a3)
    printf("3-type\n");
  else if (a11)
    printf("11-type\n");
  else
    printf("2-type\n%d\n", d);
  return 0;
}
