NOTE_NAMES = ['C', ['C#', 'Db'], 'D', ['D#', 'Eb'], 'E', 'F', ['F#', 'Gb'], 'G', ['G#', 'Ab'], 'A', ['A#', 'Bb'], 'B']

def get_index_derivative_stage_note(note: str) -> int: 
    for i in range(len(NOTE_NAMES)):
        if type(NOTE_NAMES[i]) != list:
            continue

        for j in range(len(NOTE_NAMES[i])):
            if note == NOTE_NAMES[i][j]:
                return i

def get_index_main_stage_note(note: str) -> int:
    for i in range(len(NOTE_NAMES)):
        if type(NOTE_NAMES[i]) != str:
            continue

        if note == NOTE_NAMES[i]:
            return i

def calculate_interval(notes: list[str]):
    note_positions = []

    for note in notes:
        if "#" in note or "b" in note:
            position: int = get_index_derivative_stage_note(note)
            note_positions.append(position + 1)
        else:
            position: int = get_index_main_stage_note(note)
            note_positions.append(position + 1)    
    
    interval = abs(note_positions[0] - note_positions[1])

    if interval == 11:
        return 1

    return interval

def minor_or_major(chord: str):
    notes = chord.split(" ")

    if len(notes) != 3:
        return 'Not a chord'
    
    interval_first_last = calculate_interval([notes[0], notes[-1]])

    if interval_first_last != 7:
        return 'Not a chord'

    return # message
