import java.util.*;


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

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



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

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



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

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



	} main {
		Scanner sc = new Scanner(System.in);

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s=sc.nextInt(); s sc.nextInt() sc.nextInt sc s+=10000 s 10000 int k=s%100; k s%100 s 100 int t=s/100; t s/100 s 100 if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		} (k>12 || k==0) && t<=112 && t!=100 (k>12 || k==0) && t<=112 && t!=100 (k>12 || k==0) k>12 k 12 k==0 k 0 t<=112 t 112 t!=100 t 100 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		} k<=12 && k!=0 && (t>112 || t==100) k<=12 && k!=0 && (t>112 || t==100) k<=12 k 12 k!=0 k 0 (t>112 || t==100) t>112 t 112 t==100 t 100 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		} k<=12 && t<=112 && k!=0 && t!=100 k!=0 k<=12 && t<=112 && k!=0 && t!=100 k<=12 k 12 t<=112 t 112 k!=0 k 0 t!=100 t 100 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
			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);

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



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

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



	}
} Main
import java.util.*;


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

    int s=sc.nextInt();
		s+=10000;
		int k=s%100; //下２桁
		int t=s/100; //上２桁

		if((k>12 || k==0) && t<=112 && t!=100){
			System.out.println("MMYY");
		}else if(k<=12 && k!=0 && (t>112 || t==100)){
			System.out.println("YYMM");
		}else if(k<=12 && t<=112 && k!=0 && t!=100){
			System.out.println("AMBIGUOUS");
		}else{
			System.out.println("NA");
		}



	}
}
