#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
template <typename first>
inline first abs(const first& a) {
  return a < 0 ? -a : a;
}
template <typename first>
inline first sqr(const first& a) {
  return a * a;
}
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
const int INF = 1000 * 1000 * 1000;
string notes[24] = {"C",  "C#", "D",  "D#", "E",  "F",  "F#", "G",
                    "G#", "A",  "B",  "H",  "C",  "C#", "D",  "D#",
                    "E",  "F",  "F#", "G",  "G#", "A",  "B",  "H"};
string ans[] = {"major", "minor"};
int dist(string s1, string s2) {
  for (int i = 0; i < int(24); i++)
    if (notes[i] == s1) {
      for (int j = i; j < 24; j++)
        if (notes[j] == s2) return j - i;
      throw;
    }
  throw;
}
int main() {
  string s[3];
  vector<int> perm;
  for (int i = 0; i < int(3); i++) {
    cin >> s[i];
    perm.push_back(i);
  }
  int type = -1;
  do {
    vector<string> ss;
    for (int i = 0; i < int(3); i++) ss.push_back(s[perm[i]]);
    if (dist(ss[0], ss[1]) == 4 && dist(ss[1], ss[2]) == 3)
      type = 0;
    else if (dist(ss[0], ss[1]) == 3 && dist(ss[1], ss[2]) == 4)
      type = 1;
  } while (next_permutation((perm).begin(), (perm).end()));
  if (type == -1)
    puts("strange");
  else
    puts(ans[type].c_str());
  return 0;
}
