import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

alias sread = () => readln.chomp();
enum MOD = 10 ^^ 9 + 7;

void main()
{
    auto S = sread();
    solve(S).writeln();
}

string solve(string S)
{
    long a = S[0 .. 2].to!long();
    long b = S[2 .. $].to!long();
    if ((12 < a && b == 0) || (12 < b && a == 0) || (12 < a && 12 < b) || S == "0000")
        return "NA";
    if (a <= 12 && b <= 12 && !(a == 0 || b == 0))
        return "AMBIGUOUS";
    if (a <= 12)
        return "MMYY";
    return "YYMM";
}
