#include <bits/stdc++.h>
int x[5], j = 1, b, d, ans, t, i, u = 0;
void GCD(int a, int b) {
  if (a == b) {
    x[j] = a;
    j++;
  } else if (a < b)
    GCD(b - a, a);
  else
    GCD(a - b, b);
}
int main() {
  scanf("%d", &b);
  scanf("%d", &d);
  GCD(b - 1, d);
  GCD(b, d);
  GCD(b + 1, d);
  GCD(x[1], x[3]);
  t = (x[1] * x[2] * x[3] / x[4]) % d;
  for (i = 1; i <= 8; i++) {
    if (t == 0) {
      u = i;
      break;
    } else
      t = (t * x[2]) % d;
  }
  if (u == 0)
    ans = 7;
  else {
    if (x[1] == 1 && x[3] == 1)
      ans = 2;
    else if (x[2] == 1 && x[3] == 1)
      ans = 3;
    else if (x[1] == 1 && x[2] == 1)
      ans = 11;
    else if (x[1] == 1 || x[3] == 1)
      ans = 6;
    else if (x[2] > 1)
      ans = 6;
    else if (x[3] == 2)
      ans = 3;
    else if (x[1] == 2 && x[3] > 2)
      ans = 11;
    else
      ans = 6;
  }
  printf("%d-type", ans);
  if (ans == 2) printf("\n%d", u);
}
