import java.util.Scanner;

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

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int pre = Integer.parseInt(S.substring(0, 2)); pre Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int post = Integer.parseInt(S.substring(2)); post Integer.parseInt(S.substring(2)) Integer.parseInt Integer S.substring(2) S.substring S 2 if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		} (0 < pre && pre < 13) && (0 < post && post < 13) (0 < pre && pre < 13) 0 < pre 0 pre pre < 13 pre 13 (0 < post && post < 13) 0 < post 0 post post < 13 post 13 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		} 0 < pre && pre < 13 0 < pre 0 pre pre < 13 pre 13 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		} 0 < post && post < 13 0 < post 0 post post < 13 post 13 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
} Main
import java.util.Scanner;

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

		int pre = Integer.parseInt(S.substring(0, 2));
		int post = Integer.parseInt(S.substring(2));

		if((0 < pre && pre < 13) && (0 < post && post < 13)) {
			System.out.println("AMBIGUOUS");
		} else if (0 < pre && pre < 13) {
			System.out.println("MMYY");
		} else if (0 < post && post < 13) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
}