#include <bits/stdc++.h>
const int MaxN = 105;
int dp[MaxN], B, D, r[MaxN];
int main() {
  scanf("%d%d", &B, &D);
  for (int d = 1; d <= D; d++) {
    int x = B % d, cnt = 1;
    for (int i = 0; i < d; i++) r[i] = 0;
    r[x] = 1;
    while (!r[0]) {
      x = x * B % d;
      if (r[x]) break;
      r[x] = ++cnt;
    }
    if (r[0]) {
      dp[d] = 2;
      continue;
    }
    if (B % d == 1) {
      dp[d] = 3;
      continue;
    }
    if (B % d == d - 1) {
      dp[d] = 11;
      continue;
    }
    x = d;
    for (int i = 2; i * i <= x; i++)
      if (x % i == 0) {
        int y = 1;
        while (x % i == 0) x /= i, y *= i;
        if (y == d || dp[y] == 7) dp[d] = 7;
      }
    if (x > 1 && (x == d || dp[x] == 7)) dp[d] = 7;
    if (!dp[d]) dp[d] = 6;
  }
  printf("%d-type\n", dp[D]);
  if (dp[D] == 2) printf("%d\n", r[0]);
  return 0;
}
