void main() {
    string s = readln.chomp;
    string s1 = s[0..2], s2 = s[2..$];
    bool yymm, mmyy;
    if ("01" <= s1 && s1 <= "12") mmyy = true;
    if ("01" <= s2 && s2 <= "12") yymm = true;
    if (yymm && mmyy) {
        writeln("AMBIGUOUS");
    } else if (yymm && !mmyy) {
        writeln("YYMM");
    } else if (!yymm && mmyy) {
        writeln("MMYY");
    } else {
        writeln("NA");
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.container;
import std.typecons;