import java.util.Scanner;
 
public class Main{
		
	public static void main(String args[]){
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	}
} import java.util.Scanner; Scanner java.util public class Main{
		
	public static void main(String args[]){
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	}
} Main public static void main(String args[]){
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	} main {
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int in = sc.nextInt(); in sc.nextInt() sc.nextInt sc int l = in/100; l in/100 in 100 int r = in%100; r in%100 in 100 if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} (r > 0 && r <= 12) && (l > 0 && l <= 12) (r > 0 && r <= 12) r > 0 r 0 r <= 12 r 12 (l > 0 && l <= 12) l > 0 l 0 l <= 12 l 12 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} (l > 0 && l <= 12) && r >= 0 (l > 0 && l <= 12) l > 0 l 0 l <= 12 l 12 r >= 0 r 0 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} (r > 0 && r <= 12) && l >= 0 (r > 0 && r <= 12) r > 0 r 0 r <= 12 r 12 l >= 0 l 0 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			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 in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	}
} public class Main{
		
	public static void main(String args[]){
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	}
} Main
import java.util.Scanner;
 
public class Main{
		
	public static void main(String args[]){
		  
		Scanner sc = new Scanner(System.in);
		
		int in = sc.nextInt();
		
		int l = in/100;
		int r = in%100;
		
		if((r > 0 && r <= 12) && (l > 0 && l <= 12)) {
			System.out.println("AMBIGUOUS");
		}else if((l > 0 && l <= 12) && r >= 0) {
			System.out.println("MMYY");
		}else if((r > 0 && r <= 12) && l >= 0) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
		
	}
}
