import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);	
		
		String str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			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 str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);	
		
		String str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		}
	} main {
		
		Scanner sc = new Scanner(System.in);	
		
		String str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String[] strs = str.split(""); strs str.split("") str.split str "" StringBuffer sbfirst = new StringBuffer(); sbfirst new StringBuffer() StringBuffer sbend = new StringBuffer(); sbend new StringBuffer() for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		} int i=0; int i=0; i 0 i<2 i 2 i++ i++ i {
			sbfirst.append(strs[i]);
		} {
			sbfirst.append(strs[i]);
		} sbfirst.append(strs[i]) sbfirst.append sbfirst strs[i] strs i for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		} int i=2; int i=2; i 2 i<4 i 4 i++ i++ i {
			sbend.append(strs[i]);
		} {
			sbend.append(strs[i]);
		} sbend.append(strs[i]) sbend.append sbend strs[i] strs i int firstint = Integer.parseInt(sbfirst.toString()); firstint Integer.parseInt(sbfirst.toString()) Integer.parseInt Integer sbfirst.toString() sbfirst.toString sbfirst int endint = Integer.parseInt(sbend.toString()); endint Integer.parseInt(sbend.toString()) Integer.parseInt Integer sbend.toString() sbend.toString sbend if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} firstint<=12 && endint<=12 && firstint != 0 && endint != 0 firstint != 0 firstint<=12 && endint<=12 && firstint != 0 && endint != 0 firstint<=12 firstint 12 endint<=12 endint 12 firstint != 0 firstint 0 endint != 0 endint 0 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} firstint > 12 && endint>0 && endint <=12 firstint > 12 && endint>0 && endint <=12 firstint > 12 firstint 12 endint>0 endint 0 endint <=12 endint 12 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} endint >12 && firstint<=12 && firstint != 0 endint >12 && firstint<=12 && firstint != 0 endint >12 endint 12 firstint<=12 firstint 12 firstint != 0 firstint 0 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} firstint >12 && endint == 0 firstint >12 firstint 12 endint == 0 endint 0 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} endint >12 && firstint == 00 endint >12 endint 12 firstint == 00 firstint 00 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} firstint <=12 && firstint !=0 && endint == 0 firstint <=12 && firstint !=0 && endint == 0 firstint <=12 firstint 12 firstint !=0 firstint 0 endint == 0 endint 0 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} endint <= 12 && endint != 0 && firstint == 0 endint <= 12 && endint != 0 && firstint == 0 endint <= 12 endint 12 endint != 0 endint 0 firstint == 0 firstint 0 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} endint ==0 && firstint ==0 endint ==0 endint 0 firstint ==0 firstint 0 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(firstint >12 && endint > 12) {
			System.out.println("NA");
		} firstint >12 && endint > 12 firstint >12 firstint 12 endint > 12 endint 12 {
			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 str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		}
	}
} public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);	
		
		String str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			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 str = sc.next();
		
		String[] strs = str.split("");
		
		StringBuffer sbfirst = new StringBuffer();
		StringBuffer sbend = new StringBuffer();
		
		for(int i=0; i<2; i++) {
			sbfirst.append(strs[i]);
		}
		for(int i=2; i<4; i++) {
			sbend.append(strs[i]);
		}
		int firstint = Integer.parseInt(sbfirst.toString());
		int endint = Integer.parseInt(sbend.toString());
		
		if(firstint<=12 && endint<=12 && firstint != 0 && endint != 0) {
			System.out.println("AMBIGUOUS");
		}else if(firstint > 12 && endint>0 && endint <=12) {
			System.out.println("YYMM");
		}else if(endint >12 && firstint<=12 && firstint != 0) {
			System.out.println("MMYY");
		}else if(firstint >12 && endint == 0) {
			System.out.println("NA");
		}else if(endint >12 && firstint == 00) {
			System.out.println("NA");
		}else if(firstint <=12 && firstint !=0 && endint == 0) {
			System.out.println("MMYY");
		}else if(endint <= 12 && endint != 0 && firstint == 0) {
			System.out.println("YYMM");
		}else if(endint ==0 && firstint ==0) {
			System.out.println("NA");
		}else if(firstint >12 && endint > 12) {
			System.out.println("NA");
		}
	}
}
