def abMM(head1)
    if head1 <= 12 && head1 >= 1
        return true
    else 
        return false
    end
end

def cdMM(back1)
    if back1 <= 12 && back1 >= 1
        return true
    else 
        return false
    end
end

num = gets.to_i
head = num / 100
back = num - head * 100

if abMM(head) && cdMM(back)
    puts('AMBIGUOUS')
elsif abMM(head) && !cdMM(back)
    puts('MMYY')
elsif !abMM(head) && cdMM(back)
    puts('YYMM')
else 
    puts('NA')
end

