#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long>>> g(15);
long long vis[15], dis[15];
long long menor(int a, int b) {
  long long v, c, r, cc, t;
  for (int i = 0; i < 15; i++) dis[i] = 1e18;
  dis[a] = 0;
  priority_queue<pair<long long, long long>> pq;
  pq.push(make_pair(0, a));
  while (pq.size()) {
    v = pq.top().second;
    c = -pq.top().first;
    pq.pop();
    if (c > dis[v]) continue;
    if (v == b) return c;
    for (int i = 0; i < g[v].size(); i++) {
      r = g[v][i].first;
      cc = g[v][i].second;
      if (dis[v] + cc < dis[r]) {
        dis[r] = dis[v] + cc;
        pq.push(make_pair(-dis[r], r));
      }
    }
  }
  return 1e18;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  map<string, int> m;
  m["C"] = 1;
  m["C#"] = 2;
  m["D"] = 3;
  m["D#"] = 4;
  m["E"] = 5;
  m["F"] = 6;
  m["F#"] = 7;
  m["G"] = 8;
  m["G#"] = 9;
  m["A"] = 10;
  m["B"] = 11;
  m["H"] = 12;
  g[m["C"]].push_back(make_pair(m["C#"], 1));
  g[m["C#"]].push_back(make_pair(m["D"], 1));
  g[m["D"]].push_back(make_pair(m["D#"], 1));
  g[m["D#"]].push_back(make_pair(m["E"], 1));
  g[m["E"]].push_back(make_pair(m["F"], 1));
  g[m["F"]].push_back(make_pair(m["F#"], 1));
  g[m["F#"]].push_back(make_pair(m["G"], 1));
  g[m["G"]].push_back(make_pair(m["G#"], 1));
  g[m["G#"]].push_back(make_pair(m["A"], 1));
  g[m["A"]].push_back(make_pair(m["B"], 1));
  g[m["B"]].push_back(make_pair(m["H"], 1));
  g[m["H"]].push_back(make_pair(m["C"], 1));
  string a, b, c;
  cin >> a >> b >> c;
  int ab = menor(m[a], m[b]);
  int ba = menor(m[b], m[a]);
  int bc = menor(m[b], m[c]);
  int cb = menor(m[c], m[b]);
  int ca = menor(m[c], m[a]);
  int ac = menor(m[a], m[c]);
  if ((ab == 4 && bc == 3) || (bc == 4 && ca == 3) || (ca == 4 && ab == 3) ||
      (ba == 4 && ac == 3) || (cb == 4 && ba == 3) || (ac == 4 && cb == 3))
    cout << "major\n";
  else if ((ab == 3 && bc == 4) || (bc == 3 && ca == 4) ||
           (ca == 3 && ab == 4) || (ba == 3 && ac == 4) ||
           (cb == 3 && ba == 4) || (ac == 3 && cb == 4))
    cout << "minor\n";
  else
    cout << "strange\n";
  return 0;
}
