import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	} main {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S        = scanner.next(); S scanner.next() scanner.next scanner int front = Integer.parseInt(S.substring(0,2)); front Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 int back  = Integer.parseInt(S.substring(2,4)); back Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		} (front != 0 && front <= 12) && (back != 0 && back <= 12) (front != 0 && front <= 12) front != 0 front 0 front <= 12 front 12 (back != 0 && back <= 12) back != 0 back 0 back <= 12 back 12 {
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		} back != 0 && back <= 12 back != 0 back 0 back <= 12 back 12 {
			
			System.out.println("YYMM");
			
		//MMYYの場合
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		} front != 0 && front <= 12 front != 0 front 0 front <= 12 front 12 {
			
			System.out.println("MMYY");
		//NAの場合
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			
			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 scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	}
} public class Main {

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		String S        = scanner.next();
		//上2桁を取得し数値に変換
		int front = Integer.parseInt(S.substring(0,2));
		//下2桁を取得し数値に変換
		int back  = Integer.parseInt(S.substring(2,4));
		
		//AMBIGUOUSの場合
		if((front != 0 && front <= 12) && (back != 0 && back <= 12)){
			
			System.out.println("AMBIGUOUS");
			
		//YYMMの場合
		}else if(back != 0 && back <= 12){
			
			System.out.println("YYMM");
			
		//MMYYの場合
		}else if(front != 0 && front <= 12){
			
			System.out.println("MMYY");
		//NAの場合
		}else{
			
			System.out.println("NA");
		}
	}
}
