import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"}; items {"01","02","03","04","05","06","07","08","09","10","11","12"} "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" List<String> l = Arrays.asList(items); l Arrays.asList(items) Arrays.asList Arrays items String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String mae = s.substring(0, 2); mae s.substring(0, 2) s.substring s 0 2 String ushiro = s.substring(2,4); ushiro s.substring(2,4) s.substring s 2 4 String ans = null; ans null if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		} l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0 l.indexOf(mae) >=0 l.indexOf(mae) l.indexOf l mae 0 l.indexOf(ushiro) >=0 l.indexOf(ushiro) l.indexOf l ushiro 0 {
			ans="AMBIGUOUS";
		} ans="AMBIGUOUS" ans "AMBIGUOUS" if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		} l.indexOf(mae)>=0 l.indexOf(mae) l.indexOf l mae 0 {
			ans="MMYY";
		} ans="MMYY" ans "MMYY" if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		} l.indexOf(ushiro)>=0 l.indexOf(ushiro) l.indexOf l ushiro 0 {
			ans="YYMM";
		} ans="YYMM" ans "YYMM" {
			ans ="NA";
		} ans ="NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] items = {"01","02","03","04","05","06","07","08","09","10","11","12"};
		List<String> l = Arrays.asList(items);
		String s = sc.nextLine();
		String mae = s.substring(0, 2);
		String ushiro = s.substring(2,4);
		String ans = null;
		if(l.indexOf(mae) >=0  && l.indexOf(ushiro) >=0) {
			ans="AMBIGUOUS";
		}else if(l.indexOf(mae)>=0) {
			ans="MMYY";
		}else if(l.indexOf(ushiro)>=0) {
			ans="YYMM";
		}else {
			ans ="NA";
		}
		System.out.println(ans);
	}
}