import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		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);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S =sc.nextLine(); S sc.nextLine() sc.nextLine sc int[] form = new int[3]; form new int[3] 3 form[0] =Integer.parseInt(S.substring(0, 2)) form[0] form 0 Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 form[1] =Integer.parseInt(S.substring(2, 4)) form[1] form 1 Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		} form[0] > 0 && form[0] < 13 form[0] > 0 form[0] form 0 0 form[0] < 13 form[0] form 0 13 {
			yearSurv(form[1]);
		} yearSurv(form[1]) yearSurv form[1] form 1 if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		} form[0] >= 13 && form[0] < 100 form[0] >= 13 form[0] form 0 13 form[0] < 100 form[0] form 0 100 {
			monthSurv(form[1]);
		} monthSurv(form[1]) monthSurv form[1] form 1 if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		} form[0] == 0 form[0] form 0 0 {
			monthSurv(form[1]);
		} monthSurv(form[1]) monthSurv form[1] form 1 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	} yearSurv {
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	} if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		} year > 0 && year <13 year > 0 year 0 year <13 year 13 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		} year >= 13 && year <100 year >= 13 year 13 year <100 year 100 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		} year == 0 year 0 {
			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" int year year public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	} monthSurv {
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	} if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		} month > 0 && month < 13 month > 0 month 0 month < 13 month 13 {
			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" int month month public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S =sc.nextLine();
		int[] form = new int[3];
		form[0] =Integer.parseInt(S.substring(0, 2));
		form[1] =Integer.parseInt(S.substring(2, 4));
		if(form[0] > 0 && form[0] < 13){
			yearSurv(form[1]);
		}
		else if(form[0] >= 13 && form[0] < 100){
			monthSurv(form[1]);
		}
		else if(form[0] == 0){
			monthSurv(form[1]);
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void yearSurv(int year){
		if(year > 0 && year <13 ){
			System.out.println("AMBIGUOUS");
		}
		else if(year >= 13 && year <100){
			System.out.println("MMYY");
		}
		else if(year == 0){
			System.out.println("MMYY");
		}
		else{
			System.out.println("NA");
		}
	}
	
	public static void monthSurv(int month){
		if(month > 0 && month < 13){
			System.out.println("YYMM");
		}
		else{
			System.out.println("NA");
		}
	}
}

