import java.util.Scanner;

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

	public static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	}
} 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 a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}

	public static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			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 a = Integer.parseInt(s.substring(0,2)) a Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 b=Integer.parseInt(s.substring(2)); b Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} checkMM(a)  && checkMM(b) checkMM(a) checkMM a checkMM(b) checkMM b {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} checkMM(a) checkMM a {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} checkMM(b) checkMM b {
			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 static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	} checkMM {
		if(i > 0 && i < 13) return true;
		return false;
	} if(i > 0 && i < 13) return true; i > 0 && i < 13 i > 0 i 0 i < 13 i 13 return true; true return false; false int i i public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}

	public static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}

	public static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	}
} 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 a = Integer.parseInt(s.substring(0,2)),b=Integer.parseInt(s.substring(2));
		if(checkMM(a)  && checkMM(b)) {
			System.out.println("AMBIGUOUS");
		}else if(checkMM(a)){
			System.out.println("MMYY");
		}else if(checkMM(b)) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}

	public static boolean checkMM(int i) {
		if(i > 0 && i < 13) return true;
		return false;
	}
}