Chords of Music
We are going to learn bit more about music.
You probably know that music may sound either joyfully and lightly, or seiously, melancholic or even sad.
This "temper" of the music is based on very simple math relations! Prepare for this great mystery to be unveiled! :)
From the Pitch and Notes you may have learned few things important for this task:
12steps make full
octave, after which notes repeat but with doubled frequency;
12names to distinguish them in the scope of octave (and octaves have their names or numbers also).
Here are the note names again, placed in order with one semitone step between them:
C C# D D# E F F# G G# A A# B
There is an important concept of
chord - the union of several notes played either simultaneously or close one after
another. We will only discuss two main chords -
Both of these chords consist of three notes of different pitch. They are called
In the pure form of the chord the
root has the lowest pitch and the
fifth has the highest.
And even more, they have precise amount of steps between them:
7steps (semi-tones) higher than
4steps higher than
4steps higher than
rootthen it is
3steps higher than the
So if we want to build the major chord with note
D as a root (e.g.
D-major) we need to play
4 steps from
D) and at last
A (which is
3 steps from
The table below shows the notes of
D-minor chords so you can count the steps yourself.
| C C# D D# E F F# G G# A A# B ----+------------------------------------------- D-major | * 4 * 3 * | D-minor | * 3 * 4 *
Of course if while building a chord we met the end of octave, we simply wrap to the next octave, e.g. for
notes would be
And now here is the secret - major chords make "happy" and "joyful" sound, while minor chords bear melancholic and even
mournful expression. You may found sample sounds in the wikipedia page
Now another curious thing - any note of the chord could be shifted by the whole octave (or several) up or down - the chord
will retain its temper. E.g. raising or lowering any note by
k*12 steps does not break the chord!
Popular example of this is an Inverted chord where, for example, the root is raised one octave up. Sometimes they are distinguished from pure chords, but generally speaking they could substitute one another for example if it is easier to play without breaking fingers.
Another example is playing additional sound to the chord - the same as
root but lowered octave or two - such a base
bass note which may be useful to audibly highlight accents while accompanying vocal etc.
You are given several notes described by their numbers according to MIDI-standard -
C of the
0-th octave is
in the same octave is
11 and so on, so that
E of the
The task is to determine what chord these notes represent.
Input data contain the number of test-cases in the first line.
Next lines contain from
3 or more integers - numbers of notes played.
Answer should contain respective chord names in form
F#-major or the word
in cases when notes do not form one of these two chords at all.
input data: 3 87 73 64 61 46 37 53 58 70 44 48 51 56 32 answer: other A#-minor G#-major