import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	} main {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.next(); str scan.next() scan.next scan int left = Integer.valueOf(str.substring(0, 2)); left Integer.valueOf(str.substring(0, 2)) Integer.valueOf Integer str.substring(0, 2) str.substring str 0 2 int right = Integer.valueOf(str.substring(2)); right Integer.valueOf(str.substring(2)) Integer.valueOf Integer str.substring(2) str.substring str 2 String ans = "NA"; ans "NA" if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		} (left >= 1 && left <= 12) && (right >= 1 && right <= 12) (left >= 1 && left <= 12) left >= 1 left 1 left <= 12 left 12 (right >= 1 && right <= 12) right >= 1 right 1 right <= 12 right 12 {
			ans = "AMBIGUOUS";
		} ans = "AMBIGUOUS" ans "AMBIGUOUS" if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		} left >= 1 && left <= 12 left >= 1 left 1 left <= 12 left 12 {
			ans = "MMYY";
		} ans = "MMYY" ans "MMYY" if (right >= 1 && right <= 12) {
			ans = "YYMM";
		} right >= 1 && right <= 12 right >= 1 right 1 right <= 12 right 12 {
			ans = "YYMM";
		} ans = "YYMM" ans "YYMM" 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 scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
}