import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	}
	
	public static boolean check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	}
	
	public static boolean check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} check(s[0],s[1]) check s[0] s 0 s[1] s 1 {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		} if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} check(s[2],s[3]) check s[2] s 2 s[3] s 3 {
				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(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} check(s[2],s[3]) check s[2] s 2 s[3] s 3 {
				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 check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	} check {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	} int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b)); ch (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b)) (Character.getNumericValue(a))*10 (Character.getNumericValue(a)) Character.getNumericValue Character a 10 (Character.getNumericValue(b)) Character.getNumericValue Character b if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		} 1 <= ch && ch <= 12 1 <= ch 1 ch ch <= 12 ch 12 {
			return true;
		} return true; true {
			return false;
		} return false; false char a a char b b public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	}
	
	public static boolean check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	}
	
	public static boolean check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(check(s[0],s[1])) {
			if(check(s[2],s[3])) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(check(s[2],s[3])) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
	}
	
	public static boolean check(char a, char b) {
		int ch = (Character.getNumericValue(a))*10
				    +(Character.getNumericValue(b));
		if(1 <= ch && ch <= 12) {
			return true;
		}else {
			return false;
		}
	}
}