#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
bool used[111], dp[111];
int get(int b, int d, bool first = false) {
  int it = 1;
  int x = b % d;
  memset(used, false, sizeof(used));
  while (true) {
    if (x == 0) break;
    if (used[x]) break;
    used[x] = true;
    it++;
    x = x * b % d;
  }
  if (x == 0) {
    if (first) {
      cout << "2-type" << endl << it << endl;
      exit(0);
    }
    return 2;
  }
  if ((b - 1) % d == 0) {
    if (first) {
      cout << "3-type" << endl;
      exit(0);
    }
    return 3;
  }
  if ((b + 1) % d == 0) {
    if (first) {
      cout << "11-type" << endl;
      exit(0);
    }
    return 11;
  }
  return 7;
}
int main() {
  int b, d;
  cin >> b >> d;
  int ret = get(b, d, true);
  bool ok = true;
  int i = 2;
  while (i * i < d) {
    if (d % i == 0) {
      int y = 1;
      while (d % i == 0) {
        d /= i;
        y *= i;
      }
      if (get(b, y) == 7) ok = false;
    }
    i++;
  }
  if (d > 1 && get(b, d) == 7) ok = false;
  if (ok) {
    cout << "6-type" << endl;
    return 0;
  }
  cout << "7-type" << endl;
  return 0;
}
