#include <bits/stdc++.h>
using namespace std;
int main() {
  int b, d;
  scanf("%d%d", &b, &d);
  if (b % d == 1) {
    printf("3-type\n");
    return 0;
  }
  if (b % d == d - 1) {
    printf("11-type\n");
    return 0;
  }
  int ans = -1, cnt = 0;
  for (int i = 2; i <= d; i++)
    if (d % i == 0) {
      int t = 0;
      int m = 1;
      while (d % i == 0) {
        t++;
        d /= i;
        m *= i;
      }
      if (b % i == 0) {
        int tt = 1;
        int bb = b;
        while (bb % m != 0) {
          bb *= b;
          tt++;
        }
        if (tt > cnt) cnt = tt;
        if (ans == -1) {
          ans = 2;
        } else if (ans != 2) {
          ans = 6;
        }
      } else if (b % m == 1) {
        if (ans == -1) {
          ans = 3;
        } else if (ans != 3) {
          ans = 6;
        }
      } else if (b % m == m - 1) {
        if (ans == -1) {
          ans = 11;
        } else if (ans != 11) {
          ans = 6;
        }
      } else {
        ans = 7;
        break;
      }
    }
  printf("%d-type\n", ans);
  if (ans == 2) printf("%d\n", cnt);
  return 0;
}
