import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				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);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				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 rigth = Integer.parseInt(S.substring(0,2)); rigth Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 int left = Integer.parseInt(S.substring(2,4)); left Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} rigth == 0 rigth 0 {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} left == 0 left 0 {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} left <= 12 left 12 {
				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" if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} rigth <= 12 rigth 12 {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		} if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} left == 0 left 0 {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} left <= 12 left 12 {
				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(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} left == 0 left 0 {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} left <= 12 left 12 {
				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);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				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);
		String S = sc.next();
		
		int rigth = Integer.parseInt(S.substring(0,2));
		int left = Integer.parseInt(S.substring(2,4));
		
		if(rigth == 0) {
			if(left == 0) {
				System.out.println("NA");
			}else if (left <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}else if (rigth <= 12) {
			if(left == 0) {
				System.out.println("MMYY");
			}else if(left <= 12){
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(left == 0) {
				System.out.println("NA");
			}else if(left <= 12){
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		
	}
}