#include <bits/stdc++.h>
using namespace std;
int nod(int x, int y) {
  if (!y)
    return x;
  else
    return nod(y, x % y);
}
int nok(int a, int b) { return a * b / nod(a, b); }
int main(void) {
  int d, t, a, b, c, k, x;
  cin >> b >> d;
  t = nod(b, d);
  for (x = d, k = 0; x > 1 && t > 1; x /= t, k++) t = nod(b, x);
  a = nod(b - 1, x);
  c = nod(b + 1, x);
  if (x == 1) {
    cout << "2-type" << endl;
    cout << k;
  } else if (x == d && (b - 1) % x == 0)
    cout << "3-type";
  else if (x == d && (b + 1) % x == 0)
    cout << "11-type";
  else if (nok(a, c) % x == 0)
    cout << "6-type";
  else
    cout << "7-type";
  return 0;
}
