import java.util.Scanner;

import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	}

} import java.util.Scanner; Scanner java.util import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID; ID_ASSIGNMENT_POLICY_ID org.omg.PortableServer public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String string = sc.nextLine(); string sc.nextLine() sc.nextLine sc String[] array = string.split(""); array string.split("") string.split string "" int[] array2 = new int[4]; array2 new int[4] 4 for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		} int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
				array2[i] = Integer.parseInt(array[i]);
		} {
				array2[i] = Integer.parseInt(array[i]);
		} array2[i] = Integer.parseInt(array[i]) array2[i] array2 i Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i int[] array3 = new int[2]; array3 new int[2] 2 int a = (array2[0]*10) + array2[1]; a (array2[0]*10) + array2[1] (array2[0]*10) array2[0] array2 0 10 array2[1] array2 1 int b = (array2[2]*10) + array2[3]; b (array2[2]*10) + array2[3] (array2[2]*10) array2[2] array2 2 10 array2[3] array2 3 if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		} a > 12 && b > 12 || a==0 && b==0 a > 12 && b > 12 a > 12 a 12 b > 12 b 12 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 < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		} a < 13 && b < 13 && a!=0 && b!=0 a!=0 a < 13 && b < 13 && a!=0 && b!=0 a < 13 a 13 b < 13 b 13 a!=0 a 0 b!=0 b 0 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		} a > 12 && b<13 && b>0 || a==0 && b<13 a > 12 && b<13 && b>0 a > 12 && b<13 && b>0 a > 12 a 12 b<13 b 13 b>0 b 0 a==0 && b<13 a==0 a 0 b<13 b 13 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		} b > 12 && a<13 && a>0 || b==0 && a<13 b > 12 && a<13 && a>0 b > 12 && a<13 && a>0 b > 12 b 12 a<13 a 13 a>0 a 0 b==0 && a<13 b==0 b 0 a<13 a 13 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			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);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	}

} Main
import java.util.Scanner;

import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String string = sc.nextLine();
		
		String[] array = string.split("");
		int[] array2 = new int[4];
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		int[] array3 = new int[2];
		int a = (array2[0]*10) + array2[1];
		int b = (array2[2]*10) + array2[3];
		
		if(a > 12 && b > 12 || a==0 && b==0) {
			System.out.println("NA");
		}else if(a < 13 && b < 13 && a!=0 && b!=0) {
			System.out.println("AMBIGUOUS");
		}else if(a > 12 && b<13 && b>0 || a==0 && b<13) {
			System.out.println("YYMM");
		}else if(b > 12 && a<13 && a>0 || b==0 && a<13){
			System.out.println("MMYY");
		}else {
			System.out.println("NA");
		}
	}

}
