#include <bits/stdc++.h>
using namespace std;
const long long modd = 1e9 + 7;
const long long inff = 1e18;
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1LL) ans = (ans * a);
    a = (a * a);
    b = b >> 1LL;
  }
  return ans;
}
long long check2(long long b, long long d) {
  long long check = 0;
  long long powval = 0;
  while (powval <= 7) {
    if (poww(b, powval) % d == 0) {
      check = powval;
      break;
    };
    powval++;
  }
  return check;
}
long long check3(long long b, long long d) {
  if (b % d == 1) return 1;
  return 0;
}
long long check11(long long b, long long d) {
  if (b % d == d - 1) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long b, d;
  cin >> b >> d;
  if (check2(b, d)) {
    cout << "2-type" << endl;
    cout << check2(b, d) << endl;
    return 0;
  }
  if (b % d == 1) {
    cout << "3-type" << endl;
    return 0;
  }
  if (b % d == d - 1) {
    cout << "11-type" << endl;
    return 0;
  }
  long long val = d, check = 0;
  map<long long, long long> mapp;
  for (long long i = 2; i < d; i++) {
    if (val % i == 0) {
      if (!(check2(b, i) || check3(b, i) || check11(b, i))) check = 1;
      if (check2(b, i)) {
        mapp[2] = 1;
      } else if (check3(b, i)) {
        mapp[3] = 1;
      } else if (check11(b, i)) {
        mapp[11] = 1;
      }
      while (val % i == 0) val /= i;
    }
  }
  long long sum = 0;
  for (auto j : mapp) sum += j.second;
  if (check == 0 && sum >= 2) {
    cout << "6-type" << endl;
    return 0;
  }
  cout << "7-type" << endl;
  return 0;
}
