import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);

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

		String S = sc.next();
		
	
		boolean isYM=true,isMY=true;
		
		int left = Integer.parseInt(S.substring(0, 2));
		int right = Integer.parseInt(S.substring(2,4));
		
		if(left>12) {
			isMY = false;
		}
		
		if(right>12){
			isYM = false;
		}
		
		if(left==0){
			isMY = false;
		}
		
		if(right==0) {
			isYM = false;
		}
		
		
		if(isMY&&isYM) {
			System.out.println("AMBIGUOUS");
		}else if(isMY&&!isYM){
			System.out.println("MMYY");
		}else if(!isMY&&isYM){
			System.out.println("YYMM");
		}else if(!isMY&&!isYM){
			System.out.println("NA");
		}
		
	} main {
		Scanner sc = new Scanner(System.in);

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

		String S = sc.next();
		
	
		boolean isYM=true,isMY=true;
		
		int left = Integer.parseInt(S.substring(0, 2));
		int right = Integer.parseInt(S.substring(2,4));
		
		if(left>12) {
			isMY = false;
		}
		
		if(right>12){
			isYM = false;
		}
		
		if(left==0){
			isMY = false;
		}
		
		if(right==0) {
			isYM = false;
		}
		
		
		if(isMY&&isYM) {
			System.out.println("AMBIGUOUS");
		}else if(isMY&&!isYM){
			System.out.println("MMYY");
		}else if(!isMY&&isYM){
			System.out.println("YYMM");
		}else if(!isMY&&!isYM){
			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();
		
	
		boolean isYM=true,isMY=true;
		
		int left = Integer.parseInt(S.substring(0, 2));
		int right = Integer.parseInt(S.substring(2,4));
		
		if(left>12) {
			isMY = false;
		}
		
		if(right>12){
			isYM = false;
		}
		
		if(left==0){
			isMY = false;
		}
		
		if(right==0) {
			isYM = false;
		}
		
		
		if(isMY&&isYM) {
			System.out.println("AMBIGUOUS");
		}else if(isMY&&!isYM){
			System.out.println("MMYY");
		}else if(!isMY&&isYM){
			System.out.println("YYMM");
		}else if(!isMY&&!isYM){
			System.out.println("NA");
		}
		
	}
}