A Minor and C Major

No attempts yetTime limit1sMemory limit128 MB

Problem

Hyeonhwan is learning the piano at a music academy. One day his teacher handed him a score with no key signature and asked him to figure out which scale it was written in. Hyeonhwan started learning only recently, so he can tell apart just two scales: A minor and C major.

In modern music an octave consists of the 12 pitches {A, A#, B, C, C#, D, D#, E, F, F#, G, G#}. The notes of A minor, in order, are (A, B, C, D, E, F, G), and the notes of C major, in order, are (C, D, E, F, G, A, B).

The two scales are built from the same set of notes, so what is the difference?

The first difference is the central tones. In a scale, the first note is the tonic, the fourth note is the subdominant, and the fifth note is the dominant; these three notes are called the central tones. Thus the central tones of A minor are A, D, E, and the central tones of C major are C, F, G.

The second difference is the interval. In A minor the third note, C, is three semitones above the tonic A, while in C major the third note, E, is four semitones above the tonic C. Because of this difference in interval, a minor scale sounds sad and a major scale sounds joyful.

Given a piece of music written in either A minor or C major, write a program that determines its scale. The rules are as follows.

  • Look at the first note of every measure. The scale whose central tones appear more often among these first notes is the scale of the music.
  • If both scales have the same count of central tones, decide by the last note of the music. If the last note is one of A, D, E the scale is A minor; if it is one of C, F, G the scale is C major.

For example, consider the score of the famous tune Frère Jacques, where | is the bar line that separates measures.

CD|EC|CD|EC|EF|G|EF|G|GAGF|EC|GAGF|EC|CG|C|CG|C

Writing down only the first note of each measure in order gives (C, E, C, E, E, G, E, G, G, E, G, E, C, C, C, C). Among these, (C, C, G, G, G, G, C, C, C, C) are central tones of C major and (E, E, E, E, E, E) are central tones of A minor, so this tune is in C major.

Input

The first line contains a string representing the music. The string consists only of the characters {A, B, C, D, E, F, G, |}, and its length is at least 5 and at most 100. Bar lines | never appear consecutively and never appear at either end of the string.

Output

Print C-major if the music is in C major, or A-minor if it is in A minor. The input is always given so that the answer is unambiguously one of the two scales.