#include <bits/stdc++.h>
int res[102];
int nopow(int a, int b) {
  if (a > b) return 1;
  for (int i = a; i <= b; i *= a)
    if (i == b) return 0;
  return 1;
}
int main() {
  int b, d, step;
  scanf("%d%d", &b, &d);
  memset(res, 0, sizeof(res));
  for (int k = 2; k <= d; ++k) {
    step = 0;
    for (int i = 1, t = 1; t < (1 << 20); ++i) {
      t *= b;
      if (t % k == 0) {
        step = i;
        res[k] = 2;
        goto ret;
      }
    }
    if (b % k == 1) {
      res[k] = 3;
      goto ret;
    } else {
      for (int i = 1, t = b; t < (1 << 20); t *= b)
        if ((t % k == 1 && t * b % k == (k - 1)) ||
            (t % k == (k - 1) && t * b % k == 1)) {
          res[k] = 11;
          goto ret;
        }
      for (int i = 2; i < sqrt(k + 1.0); ++i)
        if (k % i == 0 && res[i] != 7 && res[k / i] != 7 && nopow(i, k)) {
          res[k] = 6;
          goto ret;
        }
    }
    res[k] = 7;
  ret:
    continue;
  }
  printf("%d-type\n", res[d]);
  if (res[d] == 2) printf("%d\n", step);
  return 0;
}
