#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  int b, d;
  cin >> b >> d;
  int cnt = 0;
  while (gcd(b, d) > 1) {
    cnt++;
    d /= gcd(b, d);
  }
  if (d == 1) {
    cout << "2-type\n" << cnt << endl;
  } else if (cnt == 0 && b % d == 1) {
    cout << "3-type" << endl;
  } else if (cnt == 0 && b % d == d - 1) {
    cout << "11-type" << endl;
  } else if ((b * b - 1) / (b % 2 + 1) % d == 0) {
    cout << "6-type" << endl;
  } else {
    cout << "7-type" << endl;
  }
  return 0;
}
