#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
  mp.clear();
  mp["C"] = 1;
  mp["C#"] = 2;
  mp["D"] = 3;
  mp["D#"] = 4;
  mp["E"] = 5;
  mp["F"] = 6;
  mp["F#"] = 7;
  mp["G"] = 8;
  mp["G#"] = 9;
  mp["A"] = 10;
  mp["B"] = 11;
  mp["H"] = 12;
  string s1, s2, s3;
  int a[10];
  cin >> s1 >> s2 >> s3;
  a[1] = mp[s1];
  a[2] = mp[s2];
  a[3] = mp[s3];
  int dist1, dist2;
  int flag = 0;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      for (int k = 1; k <= 3; k++) {
        if (i == j || i == k || j == k) continue;
        int dist1, dist2;
        if (a[j] >= a[i])
          dist1 = a[j] - a[i];
        else
          dist1 = 12 - a[i] + a[j];
        if (a[k] >= a[j])
          dist2 = a[k] - a[j];
        else
          dist2 = 12 - a[j] + a[k];
        if (dist1 == 4 && dist2 == 3) {
          flag = 1;
          break;
        } else if (dist1 == 3 && dist2 == 4) {
          flag = 2;
          break;
        }
      }
      if (flag == 1 || flag == 2) break;
    }
    if (flag == 1 || flag == 2) break;
  }
  if (flag == 1)
    cout << "major" << endl;
  else if (flag == 2)
    cout << "minor" << endl;
  else
    cout << "strange" << endl;
  return 0;
}
