import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				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);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ym = sc.nextInt(); ym sc.nextInt() sc.nextInt sc int i1 = ym/100; i1 ym/100 ym 100 int i2 = ym%100; i2 ym%100 ym 100 if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		} i1 >= 1 && i1 <= 12 i1 >= 1 i1 1 i1 <= 12 i1 12 {
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		} if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			} i2 >= 1 && i2 <=12 i2 >= 1 i2 1 i2 <=12 i2 12 {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		} if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			} i2 >= 1 && i2 <=12 i2 >= 1 i2 1 i2 <=12 i2 12 {
				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);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				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);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	}
}