import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
 
public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
} import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
} Main public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	} main {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) String S  = keyboard.next(); S keyboard.next() keyboard.next keyboard String[] T = S.split(""); T S.split("") S.split S "" int a = Integer.parseInt(T[0]); a Integer.parseInt(T[0]) Integer.parseInt Integer T[0] T 0 int b = Integer.parseInt(T[1]); b Integer.parseInt(T[1]) Integer.parseInt Integer T[1] T 1 int c = Integer.parseInt(T[2]); c Integer.parseInt(T[2]) Integer.parseInt Integer T[2] T 2 int d = Integer.parseInt(T[3]); d Integer.parseInt(T[3]) Integer.parseInt Integer T[3] T 3 int AA = 10 * a + b; AA 10 * a + b 10 * a 10 a b int BB = 10 * c + d; BB 10 * c + d 10 * c 10 c d String ans = ""; ans "" if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			} AA == 0 && BB == 0 AA == 0 AA 0 BB == 0 BB 0 {
			ans = "NA";
			} ans = "NA" ans "NA" if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			} AA <13 && BB < 13 AA <13 AA 13 BB < 13 BB 13 {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			} if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				} AA == 0 AA 0 {
					ans = "YYMM";
				} ans = "YYMM" ans "YYMM" if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				} BB == 0 BB 0 {
					ans = "MMYY";
				} ans = "MMYY" ans "MMYY" {
				ans = "AMBIGUOUS";
				} ans = "AMBIGUOUS" ans "AMBIGUOUS" if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			} AA < 13 && BB > 12 AA < 13 AA 13 BB > 12 BB 12 {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			} if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				} AA == 0 AA 0 {
					ans = "NA";
				} ans = "NA" ans "NA" {
					ans = "MMYY";
				} ans = "MMYY" ans "MMYY" if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			} AA > 12 && BB < 13 AA > 12 AA 12 BB < 13 BB 13 {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			} if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				} BB == 0 BB 0 {
					ans = "NA";
				} ans = "NA" ans "NA" {
				ans = "YYMM"; 
				} ans = "YYMM" ans "YYMM" {
				ans = "NA";
			} ans = "NA" ans "NA" System.out.print(ans) System.out.print System.out System System.out ans keyboard.close() keyboard.close keyboard String[] args args public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
} public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
} Main
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
 
public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
}
