P13355 [CodeChef] cw6
NOI
题目描述

Ayan's favourite musical instrument is the keyboard. He practices regularly as well, you can hear him playing even at 3 or 4 in the night.
Unfortunately, he got into a fight in his room and his keyboard was damaged beyond repair. However, being a rich fellow he quickly ordered another one.
But this time he felt a bit adventurous. He decided to buy a circular keyboard i.e keys are arranged in a circle.
This funky keyboard has only 12 keys though - C,C#,D,D#,E,F,F#,G,G#,A,B and S.
Since the layout is quite different to what he is used to, he needs to relearn basics of music theory again.
Firstly, a semitone is the distance between any two keys. So there are 3 semitones between D and F, and 2 semitones between S and C# (remember it is circular!)
He knows a chord is an unordered set of three or more than three keys. However, Ayan wants to start slow and considers only triads - chords of size 3.
Triads come in two varieties - major and minor. In a major triad the number of semitones between the first and second key is 4, and between the second and third - 3.
Minor triads on the other hand have 3 semitones between the first and second keys, 4 semitones between the second and third one.
For example, D F# A is a major triad, while D F A is minor.
Ayan needs your help classifying some basic triads. Kindly help him.

Input
The first line of input is the number of test cases T (1<=T<=25).
The next T lines contain three characters corresponding to the musical keys on the circular keyboard.
Note that # keys will be given as small letters and normal keys as capital letters. So C# will be given as c, while D will remain D.
It is guaranteed that the triads will be either major or minor.

Output
For each test case, print "Major" or "Minor" in a separate line, depending on whether the given triad is major or minor.
Example
Input:

2
E G S
S d f

Output:
Minor
Major

Explanation
Example case 1. E and G have a 3 semitone gap, while G and S have a 4 semitone gap. So Minor.
S and D# have a 4 semitone gap (remember circular) and D# and F# have a 3 semitone gap. So Major.

输入格式

见题面

输出格式

见题面

样例输入
2 E G S S d f
样例输出
Minor Major