import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

int readInt(){
  return readln.chomp.to!int;
}

int[] readInts(){
  return readln.chomp.split.to!(int[]);
}

void main(){
  string s = readln.chomp;
  int nf = s[0 .. 2].to!int;
  int nl = s[2 .. 4].to!int;

  bool YYMM = false, MMYY = false;

  if((nf == 0 && (nl == 0 || nl > 12)) || (nl == 0 && (nf == 0 || nf > 12))) {
    writeln("NA");
    return;
  }
  if(1 <= nf && nf <= 12) MMYY = true;
  if(1 <= nl && nl <= 12) YYMM = true;
  if(YYMM && MMYY){
    writeln("AMBIGUOUS");
  } else if(YYMM){
    writeln("YYMM");
  } else if(MMYY){
    writeln("MMYY");
  }
}
