import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isYYMM = false;
		boolean isMMYY = false;

		int fh =  Integer.parseInt(s.substring(0, 2));
		int lh =  Integer.parseInt(s.substring(2));

		if (0 < lh && lh <= 12) {
			isYYMM = true;
		}

		if (0 < fh && fh <= 12) {
			isMMYY = true;
		}

		String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ;
		System.out.println(ans);
		sc.close();
	}

} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isYYMM = false;
		boolean isMMYY = false;

		int fh =  Integer.parseInt(s.substring(0, 2));
		int lh =  Integer.parseInt(s.substring(2));

		if (0 < lh && lh <= 12) {
			isYYMM = true;
		}

		if (0 < fh && fh <= 12) {
			isMMYY = true;
		}

		String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ;
		System.out.println(ans);
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isYYMM = false;
		boolean isMMYY = false;

		int fh =  Integer.parseInt(s.substring(0, 2));
		int lh =  Integer.parseInt(s.substring(2));

		if (0 < lh && lh <= 12) {
			isYYMM = true;
		}

		if (0 < fh && fh <= 12) {
			isMMYY = true;
		}

		String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ;
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isYYMM = false;
		boolean isMMYY = false;

		int fh =  Integer.parseInt(s.substring(0, 2));
		int lh =  Integer.parseInt(s.substring(2));

		if (0 < lh && lh <= 12) {
			isYYMM = true;
		}

		if (0 < fh && fh <= 12) {
			isMMYY = true;
		}

		String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ;
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc boolean isYYMM = false; isYYMM false boolean isMMYY = false; isMMYY false int fh =  Integer.parseInt(s.substring(0, 2)); fh Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int lh =  Integer.parseInt(s.substring(2)); lh Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if (0 < lh && lh <= 12) {
			isYYMM = true;
		} 0 < lh && lh <= 12 0 < lh 0 lh lh <= 12 lh 12 {
			isYYMM = true;
		} isYYMM = true isYYMM true if (0 < fh && fh <= 12) {
			isMMYY = true;
		} 0 < fh && fh <= 12 0 < fh 0 fh fh <= 12 fh 12 {
			isMMYY = true;
		} isMMYY = true isMMYY true String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ; ans isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" isYYMM isMMYY ? "AMBIGUOUS" : "YYMM" isMMYY "AMBIGUOUS" "YYMM" isMMYY ? "MMYY" : "NA" isMMYY "MMYY" "NA" System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isYYMM = false;
		boolean isMMYY = false;

		int fh =  Integer.parseInt(s.substring(0, 2));
		int lh =  Integer.parseInt(s.substring(2));

		if (0 < lh && lh <= 12) {
			isYYMM = true;
		}

		if (0 < fh && fh <= 12) {
			isMMYY = true;
		}

		String ans = isYYMM ? isMMYY ? "AMBIGUOUS" : "YYMM"
				: isMMYY ? "MMYY" : "NA" ;
		System.out.println(ans);
		sc.close();
	}

}
