Bob is studying for his music theory exam and needs your help!
In music, there are 12 distinct tones. They are named, in ascending order, A, A#, B, C, C#, D, D#, E, F, F#, G,
and G#
. (Note that there is no B#
or E#
.) After G#
, the sequence cycles back to A
and repeats. The distance between two adjacent tones is one semitone.
The interval between two tones and is the distance in semitones from tone to tone . For example, the interval between F
and A#
is 5 semitones (F -> F# -> G -> G# -> A -> A#
= 5 steps from F
to A#
) and the interval between A#
and F
is 7 semitones (A# -> B -> C -> C# -> D -> D# -> E -> F
).
A triad is a certain kind of sequence of 3 tones (ex. F#, A, C#
). There are 4 types of triads. If the intervals between the first and second tones and the second and third tones are and semitones respectively, the triad is major (ex. C, E, G
). If they are and , the triad is minor (ex. C, D#, G
). If they are and , the triad is augmented (ex. C, E, G#
). If they are and , the triad is diminished (ex. C, D#, F#
).
Triads can come in 3 different inversions. A triad in root position follows one of the 4 interval patterns described above (ex. E, G#, B
). A triad in first inversion has a cyclic shift of 1 to the left from its root position (ex. G#, B, E
), and a triad in second inversion has a cyclic shift of 2 to the left from its root position (ex. B, E, G#
).
The first tone of the triad when it is shifted to root position is known as its root. For example, the root of G#, B, E
is E
and the root of C, D#, G
is C
.
Given a triad, help Bob find its root, type, and inversion.
If the given triad is augmented, assume it is in root position.
Input Specification
3 lines with a valid tone on each line. The -th line contains the -th tone of the triad.
The triad represented by the tones is guaranteed to be a valid major, minor, augmented, or diminished triad in root position, first inversion, or second inversion.
Output Specification
Output the root of the triad, the type of the triad (major
, minor
, augmented
, or diminished
), and the inversion of the triad (root position
, first inversion
, or second inversion
), each on its own line.
Note that the augmented triad is unique in that its first and second inversions can also be augmented triads in another root (for example, C, E, G#
can be root-position with root C
or first-inversion with root G#
). Thus, if the given triad is augmented, assume it is in root position.
Sample Input 1
C
E
G
Sample Output 1
C
major
root position
Sample Input 2
A#
E
G
Sample Output 2
E
diminished
second inversion
Sample Input 3
F#
A#
D
Sample Output 3
F#
augmented
root position
Comments
When your music teacher tries to solve it...
where are the flats and double sharps and double flats
Please it's painful enough