import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = Integer.parseInt(sc.next()); s Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int L = s / 100; L s / 100 s 100 int R = s % 100; R s % 100 s 100 if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		} 1 <= L && L <= 12 1 <= L 1 L L <= 12 L 12 {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY"); 1 <= R && R <= 12 1 <= R 1 R R <= 12 R 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		} if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA"); 1 <= R && R <= 12 1 <= R 1 R R <= 12 R 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
} public class Main {
 
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
} Main
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
}