The names of the notes on a standard 88-key piano keyboard begin with A (the lowest note) and then continue in order: A# (A-sharp), B, C, C#, D, D#, E, F, F#, G, and finally G#. After these 12 names, the same sequence repeats. Some notes have alternate names: A# may also be called B♭ (B-flat), C# may be called D♭, D# may be called E♭, F# may be called G♭, and G# may be called A♭.
The gap between two adjacent note names (for example A → A#, or B → C) is one semitone. Because the 12 names repeat, the notes form a cycle: after G# comes A again.
Most music uses chords — groups of notes played at the same time. Here we ignore which octave each note is in and judge a chord purely from the spacing (in semitones) between its notes.
Any three notes with these spacings form the chord, no matter what order they are given in or which octave they belong to.
The input is a sequence of lines. Every line except the last contains the names of exactly three notes. Decide whether the three notes together form a Major or a Minor chord, and if so, name the chord.
The notes may appear in any order. Input is case-insensitive, and the flat symbol ♭ is written as the letter b. One or more spaces separate the notes on a line, and spaces may also appear before the first note or after the last note. Every note on these lines is well-formed, so you need not check for errors.
The final line is entirely blank and marks the end of the input.
For each input line (before the terminating blank line), print one line.
First echo the three note names exactly as they appear in the input (preserving their case and #/b spelling), separated by single spaces, then append:
is a <ROOT> Major chord. if the notes form a Major chord, is a <ROOT> Minor chord. if they form a Minor chord, is unrecognized. otherwise.Name chord roots using sharps only — use # where needed and never the flat symbol.