import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static int K;

	public static void main(String[] args) {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static int K;

	public static void main(String[] args) {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	}

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

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	} main {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	} String S = sc.next(); S sc.next() sc.next sc int A = Integer.parseInt(S.substring(0, 2)); A Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int B = Integer.parseInt(S.substring(2, 4)); B Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 boolean YYMM = (1 <= B && B <= 12); YYMM (1 <= B && B <= 12) 1 <= B 1 B B <= 12 B 12 boolean MMYY = (1 <= A && A <= 12); MMYY (1 <= A && A <= 12) 1 <= A 1 A A <= 12 A 12 if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		} YYMM {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM"); MMYY System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		} if (MMYY) System.out.println("MMYY");
			else System.out.println("NA"); MMYY System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static int K;

	public static void main(String[] args) {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	}

} public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static int K;

	public static void main(String[] args) {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	}

} Main
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static int K;

	public static void main(String[] args) {
		String S = sc.next();

		int A = Integer.parseInt(S.substring(0, 2));
		int B = Integer.parseInt(S.substring(2, 4));

		boolean YYMM = (1 <= B && B <= 12);
		boolean MMYY = (1 <= A && A <= 12);

		if (YYMM) {
			if (MMYY) System.out.println("AMBIGUOUS");
			else System.out.println("YYMM");
		} else {
			if (MMYY) System.out.println("MMYY");
			else System.out.println("NA");
		}
	}

}