import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const S = readln.chomp.to!int;
    const a = S / 100;
    const b = S % 100;

    bool yymm = 0 < a && 1 <= b && b <= 12;
    bool mmyy = 1 <= a && a <= 12 && 0 < b;

    if (yymm) {
        if (mmyy) {
            writeln("AMBIGUOUS");
        } else {
            writeln("YYMM");
        }
    } else {
        if (mmyy) {
            writeln("MMYY");
        } else {
            writeln("NA");
        }
    }
}

