import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int count=0; count 0 int tens=((S/10)-((int)(S/100))*10)*10; tens ((S/10)-((int)(S/100))*10)*10 ((S/10)-((int)(S/100))*10) (S/10) S 10 ((int)(S/100))*10 ((int)(S/100)) S 100 10 10 int ones=S%10; ones S%10 S 10 if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		} (S/100)<=12 && (S/100)!=0 (S/100)<=12 (S/100) S 100 12 (S/100)!=0 (S/100) S 100 0 {
			count+=1;
		} count+=1 count 1 if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		} (tens+ones)<=12 && (tens+ones)!=0 (tens+ones)<=12 (tens+ones) tens ones 12 (tens+ones)!=0 (tens+ones) tens ones 0 {
			count+=2;
		} count+=2 count 2 switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		} count case 0: 0 case 0: System.out.print("NA") System.out.print System.out System System.out "NA" break; case 2: 2 case 2: System.out.print("YYMM") System.out.print System.out System System.out "YYMM" break; case 1: 1 case 1: System.out.print("MMYY") System.out.print System.out System System.out "MMYY" break; case 3: 3 case 3: System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" break; sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int count=0;
		int tens=((S/10)-((int)(S/100))*10)*10;
		int ones=S%10;
		
		if((S/100)<=12 && (S/100)!=0) {
			count+=1;
		}
		if((tens+ones)<=12 && (tens+ones)!=0) {
			count+=2;
		}
		
		
		switch(count){
		case 0:
			System.out.print("NA");
			break;
		case 2:
			System.out.print("YYMM");
			break;
		case 1:
			System.out.print("MMYY");
			break;
		case 3:
			System.out.print("AMBIGUOUS");
			break;
		}
		
		sc.close();
	}
}
