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