import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

		sc.close();
	}
	
}

 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

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

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12; flgYYMM 1 <= s % 100 && s % 100 <= 12 1 <= s % 100 1 s % 100 s 100 s % 100 <= 12 s % 100 s 100 12 boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12; flgMMYY 1 <= s / 100 && s / 100 <= 12 1 <= s / 100 1 s / 100 s 100 s / 100 <= 12 s / 100 s 100 12 if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA"); flgYYMM if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM"); flgMMYY 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 (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA"); flgMMYY 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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

		sc.close();
	}
	
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

		sc.close();
	}
	
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		
		boolean flgYYMM = 1 <= s % 100 && s % 100 <= 12;
		boolean flgMMYY = 1 <= s / 100 && s / 100 <= 12;
		
		if (flgYYMM) 
			if (flgMMYY)
				System.out.println("AMBIGUOUS ");
			else
				System.out.println("YYMM");
		else
			if (flgMMYY)
				System.out.println("MMYY");
			else
				System.out.println("NA");
		

		sc.close();
	}
	
}


