import java.util.Scanner;

public class Main {

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