#include <bits/stdc++.h>
using namespace std;
int n, m;
int prime[110], tot;
int len = 0;
int judge(int x) {
  int temp = 1;
  for (int i = 1; i <= x; i++) {
    temp = temp * m % x;
    if (temp == 0) {
      len = i;
      return 2;
    }
  }
  if (m % x == 1) return 3;
  if (m % x == x - 1) return 11;
  return 7;
}
int main() {
  cin >> m >> n;
  int t = judge(n);
  if (judge(n) != 7) {
    if (t == 2) printf("2-type\n%d\n", len);
    if (t == 3) printf("3-type\n");
    if (t == 11) printf("11-type\n");
    return 0;
  }
  int tempn = n;
  for (int i = 2; i <= n; i++)
    if (n % i == 0) {
      prime[++tot] = 1;
      while (n % i == 0) n /= i, prime[tot] *= i;
    }
  n = tempn;
  for (int i = 1; i <= tot; i++) {
    int t = judge(prime[i]);
    if (t == 7) {
      printf("7-type\n");
      return 0;
    }
  }
  printf("6-type\n");
}
