import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	}

} Main public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	} main {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	} Scanner seer = new Scanner(System.in); seer new Scanner(System.in) int s = seer.nextInt(); s seer.nextInt() seer.nextInt seer int a = s / 100; a s / 100 s 100 int b = s % 100; b s % 100 s 100 if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		} a == 0 && b == 0 a == 0 a 0 b == 0 b 0 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		} a == 0 && b > 12 a == 0 a 0 b > 12 b 12 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		} b == 0 && a > 12 b == 0 b 0 a > 12 a 12 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		} a > 12 && b > 12 a > 12 a 12 b > 12 b 12 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" {
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		} if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			} a <= 12 && (b > 12 || b == 0) a <= 12 a 12 (b > 12 || b == 0) b > 12 b 12 b == 0 b 0 {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			} (a > 12 || a == 0) && b <= 12 (a > 12 || a == 0) a > 12 a 12 a == 0 a 0 b <= 12 b 12 {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int s = seer.nextInt();
		int a = s / 100;
		int b = s % 100;
		if(a == 0 && b == 0){
			System.out.println("NA");
		}
		else if(a == 0 && b > 12){
			System.out.println("NA");
		}
		else if(b == 0 && a > 12){
			System.out.println("NA");
		}
		else if(a > 12 && b > 12){
			System.out.println("NA");
		}
		else{
			if(a <= 12 && (b > 12 || b == 0)){
				System.out.println("MMYY");
			}
			else if((a > 12 || a == 0) && b <= 12){
				System.out.println("YYMM");
			}
			else{
				System.out.println("AMBIGUOUS");
			}
		}
	}

}
