#include <bits/stdc++.h>
using std::vector;
const int maxn = 110;
int B;
int f[maxn];
int sol2(int D) {
  int i;
  long long b;
  for (i = 1, b = B; i <= 9; b *= B, ++i)
    if (b % D == 0) break;
  return i <= 9 ? i : -1;
}
int sol(int d) {
  if (sol2(d) != -1) return 2;
  if (B % d == 1) return 3;
  if (B % d == d - 1) return 11;
  return 7;
}
bool dfs(int n, vector<int> A) {
  if (n == 1) return 1;
  int i, j;
  for (i = (*--A.end()) + 1; i <= n; ++i)
    if (n % i == 0 && f[i] != 7) {
      for (j = 1; j < A.size(); ++j)
        if (i % A[j] == 0) break;
      if (j == A.size()) {
        vector<int> B = A;
        B.push_back(i);
        if (dfs(n / i, B)) return 1;
      }
    }
  return 0;
}
int main() {
  int D;
  scanf("%d%d", &B, &D);
  for (int i = 2; i <= D; ++i) f[i] = sol(i);
  if (f[D] == 2) return printf("2-type\n%d", sol2(D)), 0;
  if (f[D] != 7) return printf("%d-type", f[D]), 0;
  vector<int> A;
  A.push_back(1);
  puts(dfs(D, A) ? "6-type" : "7-type");
  return 0;
}
