import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	}
	
	
	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	




static String deletestr(String base,String remove){
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

}



}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}

 import java.util.Scanner; Scanner java.util class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	}
	
	
	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	




static String deletestr(String base,String remove){
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

}



} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	} main {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc int forward = Integer.parseInt(str.substring(0,2)); forward Integer.parseInt(str.substring(0,2)) Integer.parseInt Integer str.substring(0,2) str.substring str 0 2 int back = Integer.parseInt(str.substring(2)); back Integer.parseInt(str.substring(2)) Integer.parseInt Integer str.substring(2) str.substring str 2 if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} forward > 12 &&( back > 12 || back == 0) forward > 12 forward 12 ( back > 12 || back == 0) back > 12 back 12 back == 0 back 0 {
			System.out.print("NA");
		} System.out.print("NA") System.out.print System.out System System.out "NA" if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} forward > 12 forward 12 {
			System.out.print("YYMM");
		} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} forward == 0 && (back == 0 || back > 12) forward == 0 forward 0 (back == 0 || back > 12) back == 0 back 0 back > 12 back 12 {
			System.out.print("NA");
		} System.out.print("NA") System.out.print System.out System System.out "NA" if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} forward == 0 forward 0 {
			System.out.print("YYMM");
		} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} back > 12 back 12 {
			System.out.print("MMYY");
		} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		} back != 0 back 0 {
			System.out.print("AMBIGUOUS");
		} System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" {
			System.out.print("MMYY");

		} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" String[] args args static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	} gcd {				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	} if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		} b == 0 b 0 {
			return a;
		} return a; a {
			return gcd(b, a%b);
		} return gcd(b, a%b); gcd(b, a%b) gcd b a%b a b int a a int b b static String deletestr(String base,String remove){
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

} deletestr {
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

} boolean flag = true; flag true for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	} int i = 0; int i = 0; i 0 i < remove.length() i remove.length() remove.length remove i++ i++ i {
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	} {
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	} if(i == base.length()){
			flag = false;
			break;
		} i == base.length() i base.length() base.length base {
			flag = false;
			break;
		} flag = false flag false break; if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		} base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32 base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32 base.charAt(i) - remove.charAt(i) != 0 base.charAt(i) - remove.charAt(i) base.charAt(i) base.charAt base i remove.charAt(i) remove.charAt remove i 0 base.charAt(i) - remove.charAt(i) != 32 base.charAt(i) - remove.charAt(i) base.charAt(i) base.charAt base i remove.charAt(i) remove.charAt remove i 32 remove.charAt(i) - base.charAt(i)  != 32 remove.charAt(i) - base.charAt(i) remove.charAt(i) remove.charAt remove i base.charAt(i) base.charAt base i 32 {
			flag = false;
			break;
		} flag = false flag false break; if(flag){
		base = base.substring(remove.length());
	} flag {
		base = base.substring(remove.length());
	} base = base.substring(remove.length()) base base.substring(remove.length()) base.substring base remove.length() remove.length remove return base; base String base base String remove remove class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
} Pair int from; from int end; end @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	} compareTo {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return from - otherpair.from; from - otherpair.from from otherpair.from otherpair otherpair.from Object other other Comparable
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	}
	
	
	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	




static String deletestr(String base,String remove){
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

}



}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}


