import std.stdio, std.algorithm, std.array, std.range, std.string, std.conv, std.uni;

void main() {
    auto s = readln.strip;

    auto yy = s[0..2].to!int;
    auto mm = s[2..$].to!int;

    if (1 <= mm && mm <= 12) {
        if (1 <= yy && yy <= 12) {
            writeln("AMBIGUOUS");
        } else {
            writeln("YYMM");
        }
    } else {
        if (1 <= yy && yy <= 12) {
            writeln("MMYY");

        } else {
            writeln("NA");
        }

    }
}
