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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool f(int n) {
    return 1 <= n && n <= 12;
}

string calc(string s) {
    auto a = (10 * (s[0] - '0')) + (s[1] - '0');
    auto b = (10 * (s[2] - '0')) + (s[3] - '0');

    if (f(a) && f(b)) return "AMBIGUOUS";

    if (f(a)) return "MMYY";
    if (f(b)) return "YYMM";

    return "NA";
}

void main() {
    string s = read!string;
    writeln(calc(s));
}
