#include <bits/stdc++.h>
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int N, M;
void Init() {
  Get(N);
  Get(M);
}
int GCD(int X, int Y) {
  if (Y == 0) return X;
  return GCD(Y, X % Y);
}
int Ans1;
int Ans2;
void Work() {
  int C = 0;
  for (;;) {
    int Gcd = GCD(N, M);
    if (Gcd == 1) break;
    M /= Gcd;
    C++;
  }
  if (M == 1) {
    Ans1 = 2;
    Ans2 = C;
    return;
  }
  if (C == 0 && N % M == 1) {
    Ans1 = 3;
    return;
  }
  if (C == 0 && N % M == M - 1) {
    Ans1 = 11;
    return;
  }
  if (N % M == 1) {
    Ans1 = 6;
    return;
  }
  if (N % M == M - 1) {
    Ans1 = 6;
    return;
  }
  int X = (GCD(N - 1, M) * GCD(N + 1, M));
  if ((N & 1) == 1 && ((X & 1) == 0)) X >>= 1;
  if (X % M == 0) {
    Ans1 = 6;
    return;
  }
  Ans1 = 7;
}
void Output() {
  printf("%d-type\n", Ans1);
  if (Ans1 == 2) printf("%d\n", Ans2);
}
int main() {
  Init();
  Work();
  Output();
  return 0;
}
