#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int m;
int n;
int a, b;
int gd;
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
string get(int t) {
  stringstream sout;
  sout << t << "-type";
  if (t == 2) sout << endl << gd;
  return sout.str();
}
int check(int x) {
  int o = x;
  int d = 0;
  while (gcd(o, a) != 1) {
    o /= gcd(o, a);
    d++;
  }
  if (o == 1) {
    gd = d;
    return 2;
  }
  if (a % x == 1) return 3;
  if (a % x == x - 1 && a * a % x == 1) return 11;
  return -1;
}
int main() {
  cin >> a >> b;
  int b = ::b;
  vector<int> v;
  for (int i = 2; i <= b; i++) {
    if (b % i == 0) {
      int c = 1;
      while (b % i == 0) {
        b /= i;
        c *= i;
      }
      v.push_back(c);
    }
  }
  int t = check(::b);
  if (t != -1) {
    cout << get(t);
    return 0;
  }
  for (int i = 0; i < (((int)(v).size())); i++) {
    int t = check(v[i]);
    if (t == -1) {
      cout << "7-type" << endl;
      return 0;
    }
  }
  cout << "6-type" << endl;
  return 0;
}
