Fardin is looking for his first kiss and Christmas time would be the perfect time to get it! In preparation, he tries to compose his own tunes to play for the lovely Glenforest ladies who have an excellent taste in music. Unfortunately, Fardin has not learned simple harmony yet so he is essentially scribbling down notes. For his melody, he avoids using black keys for the sake of simplicity. The keys of the piano are labelled as below.
To judge whether Fardin's melody is good or not, we have some rudimentary rules:
After a leap of a fifth or more (e.g. from C4
to G4
), the following note cannot continue in the same direction (e.g. cannot be A4
or higher), but can go in the opposite direction or stay in the same spot. Staying in the same spot is equal to going in no direction.
After a leap of a fifth or more, the following note cannot be another leap of a fifth or more.
There cannot be a leap of more than an octave (e.g. C4
to D5
).
For the purposes of this problem, define a fifth to be the distance between two white keys that have 3 white keys between them, and define an octave to be the distance between two white keys that have 6 white keys between them.
Given a melody consisting of notes, output Melodious!
if it is good or Salieri's music
if it is bad.
Input Specification
Line 1: , the number of notes.
The next lines each contain a note in the form above.
Output Specification
Output one string, Melodious!
or Salieri's music
.
Sample Input 1
10
E4
F4
C4
D4
D4
F4
G4
B4
D5
C5
Sample Output 1
Melodious!
Explanation for Sample Output 1
All the distances are less than a fifth so the melody is fine.
Sample Input 2
5
G4
C4
F3
A3
C4
Sample Output 2
Salieri's music
Explanation for Sample Output 2
The leap of five from G4
to C4
is followed another leap in the same direction, from C4
to F3
, violating both rules 1 and 2.
Comments