#include <bits/stdc++.h>
using namespace std;
int f(string s) {
  if (s == "C") return 0;
  if (s == "C#") return 1;
  if (s == "D") return 2;
  if (s == "D#") return 3;
  if (s == "E") return 4;
  if (s == "F") return 5;
  if (s == "F#") return 6;
  if (s == "G") return 7;
  if (s == "G#") return 8;
  if (s == "A") return 9;
  if (s == "B") return 10;
  if (s == "H") return 11;
}
int main() {
  string mas[3];
  int a[3], x[3];
  cin >> mas[0] >> mas[1] >> mas[2];
  for (int i = 0; i < 3; i++) x[i] = f(mas[i]);
  sort(x, x + 3);
  if (x[0] == x[1] || x[0] == x[2] || x[2] == x[1]) {
    puts("strange");
    return 0;
  }
  int l1 = x[1] - x[0], l2 = x[2] - x[1], l3 = x[0] - x[2];
  if ((l1 == 4 && l2 == 3) || (l1 == 3 && l2 == 5) || (l1 == 5 && l2 == 4)) {
    puts("major");
    return 0;
  } else if ((l1 == 3 && l2 == 4) || (l1 == 4 && l2 == 5) ||
             (l1 == 5 && l2 == 3)) {
    puts("minor");
    return 0;
  }
  puts("strange");
  return 0;
}
