#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int type[111];
int main() {
  memset(type, 0, sizeof(type));
  int b = 0, div;
  cin >> b >> div;
  for (int d = 2; d <= b; d++)
    if (b % d == 0) type[d] = 2;
  for (int d = 2; d <= 100; d++)
    for (int i = 2; i * i <= d; i++)
      if (d % i == 0)
        if (type[i] == 2 && type[d / i] == 2) {
          type[d] = 2;
          break;
        }
  for (int d = 2; d < b; d++)
    if ((b - 1) % d == 0) {
      if (type[d] == 0) type[d] = 3;
    }
  for (int d = 2; d <= b + 1; d++) {
    if ((b + 1) % d == 0 && type[d] == 0) type[d] = 11;
  }
  for (int d = 2; d <= 100; d++) {
    if (type[d] == 0) {
      for (int i = 2; i < d; i++) {
        if (d % i == 0 && d % (i * i)) {
          if (type[i] == 2 && type[d / i] == 3) type[d] = 6;
          if (type[i] == 2 && type[d / i] == 11) type[d] = 22;
          if (type[i] == 3 && type[d / i] == 11) type[d] = 33;
          if (type[i] == 2 && type[d / i] == 33) type[d] = 66;
          if (type[i] == 3 && type[d / i] == 22) type[d] = 66;
          if (type[i] == 11 && type[d / i] == 66) type[d] = 66;
          if (type[d]) break;
        }
      }
    }
  }
  for (int i = 2; i <= 100; i++)
    if (!type[i])
      type[i] = 7;
    else if (type[i] == 22 || type[i] == 33 || type[i] == 66)
      type[i] = 6;
  printf("%d-type\n", type[div]);
  if (type[div] == 2) {
    int cnt = 0, r = gcd(div, b);
    while (r > 1) {
      div /= r;
      cnt++;
      r = gcd(div, b);
    }
    printf("%d\n", cnt);
  }
  return 0;
}
