#include <bits/stdc++.h>
int intac[3];
bool maj = false, mino = false;
int dist(int a, int b) {
  return intac[b] - intac[a] + (intac[b] >= intac[a] ? 0 : 12);
}
void process(int a, int b, int c) {
  if (dist(a, b) == 4 && dist(b, c) == 3)
    maj = true;
  else if (dist(a, b) == 3 && dist(b, c) == 4)
    mino = true;
}
int main(int argc, const char* argv[]) {
  char accords[3][5];
  char tons[8] = {9, 10, 0, 2, 4, 5, 7, 11};
  for (int i = 0; i < 3; i++) {
    scanf("%s", accords[i]);
    intac[i] = tons[accords[i][0] - 'A'];
    if (accords[i][1] == '#') intac[i]++;
  }
  process(0, 1, 2);
  process(0, 2, 1);
  process(1, 0, 2);
  process(1, 2, 0);
  process(2, 0, 1);
  process(2, 1, 0);
  if (maj)
    printf("major\n");
  else if (mino)
    printf("minor\n");
  else
    printf("strange\n");
  return 0;
}
