eolymp
bolt
Try our new interface for solving problems
Problems

Getting Chorded

Getting Chorded

The "names" of the notes on a standard \textbf{88}-key piano keyboard start with \textbf{A} (the lowest note on the keyboard) and then proceed sequentially with \textbf{A#} (\textit{\textbf{A-sharp}}), \textbf{B}, \textbf{C}, \textbf{C#}, \textbf{D}, \textbf{D#}, \textbf{E}, \textbf{F}, \textbf{F#}, \textbf{G}, and finally \textbf{G#}. After the first \textbf{12} notes are named, the pattern repeats, proceeding through the last key, which is named \textbf{C}. Some notes have other common names. \textbf{A#} may also be called \textbf{B} flat (\textit{\textbf{B-flat}}), \textbf{C#} may be called \textbf{D} flat, \textbf{D#} may be called \textbf{E} flat, \textbf{F#} may be called \textbf{G }flat, and \textbf{G#} may be called Aflat (There are still other names, like \textbf{C##}, but we won't worry about those here!). 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 \textbf{C}, \textbf{E}, and \textbf{G} sounded together are called a \textbf{C} Major chord. While the particular \textbf{C}, \textbf{E} and \textbf{G} in the chord are frequently close together on the keyboard, for our purposes here, any \textbf{C}, \textbf{E}, and \textbf{G} played at the same time will constitute a \textbf{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 \textbf{C} and the \textbf{E} (namely \textbf{C#}, \textbf{D} and \textbf{D#}), and then only two skipped between the \textbf{E} and the \textbf{G} (namely \textbf{F} and \textbf{F#}). If we start with a different note, say \textbf{F#}, we can easily tell that the notes in an \textbf{F#} Major chord are \textbf{F#}, \textbf{A#}, and \textbf{C#} (skipping \textbf{G}, \textbf{G#}, and \textbf{A} between \textbf{F#} and \textbf{A#}, and skipping \textbf{B} and \textbf{C} between \textbf{A#} and \textbf{C#}). Another frequently encountered chord is the Minor chord. \textbf{C} Minor, for example, is played by sounding \textbf{C}, \textbf{D#}, and \textbf{G}. As you can see, \textbf{C#} and \textbf{D} are skipped between \textbf{C} and \textbf{D#}, and \textbf{E}, \textbf{F} and \textbf{F#} are skipped between \textbf{D#} and \textbf{G}. You should now be able to tell that the notes in an \textbf{F#} Minor chord are \textbf{F#}, \textbf{A}, and \textbf{C#}. \InputFile 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 flat will be indicated by the letter \textbf{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. \OutputFile The output is to be in the same style as shown in the examples below; do not use flat to name chords - use only \textbf{#} when necessary.
Time limit 1 second
Memory limit 64 MiB
Input example #1
C E G 
C E   F# 
G	C	E 
C Eb G 
c# a f# 
   f g#      C
Output example #1
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.