Most music includes chords, or groups of notes played at the same time. Many of these chords are given standard names. For example, the notes C, E, and G sounded together are called a C Major chord. While the particular C, E and G in the chord are frequently close together on the keyboard, for our purposes here, any C, E, and G played at the same time will constitute a C Major chord. It is the spacing between the notes on the keyboard that distinguishes a Major chord from others. As you can see, there are exactly three notes skipped between the C and the E (namely C#, D and D#), and then only two skipped between the E and the G (namely F and F#). If we start with a different note, say F#, we can easily tell that the notes in an F Major chord are F, A, and C (skipping G, G#, and A between F# and A#, and skipping B and C between A# and C#).
Another frequently encountered chord is the Minor chord. C Minor, for example, is played by sounding C, D#, and G. As you can see, C# and D are skipped between C and D#, and E, F and F# are skipped between D# and G. You should now be able to tell that the notes in an F# Minor chord are F#, A, and C#.
In this problem you will be presented with a sequence of lines, each
containing the names of three notes. You are to identify if these
three notes, taken together, form a Major or Minor chord. If they do,
you will display the name of the chord. If they don't you'll also
report that fact. Remember that the notes need not appear in the usual
sequence. Case will be ignored in the input, and the symbol will be indicated by the letter
b
. A blank or blanks will appear between the notes on
each line, and may also precede the first note on the line or follow
the third note on the line. Each line except the last will contain
exactly three properly formed notes, so you need not check for
errors. The last line will be entirely blank, and marks the end of the
input data. The output is to be in the same style as shown in the
examples below; do not use to name
chords--use only # when necessary.
C E G C E F# G C E C Eb G c# a f# f g# C
C E G is a C Major chord. C E F# is unrecognized. G C E is a C Major chord. C Eb G is a C Minor chord. c# a f# is a F# Minor chord. f g# C is a F Minor chord.