import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = sc.next(); s sc.next() sc.next sc int a = Integer.parseInt(s.substring(0, 2)); a Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int b = Integer.parseInt(s.substring(2, 4)); b Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		} a <= 12 && b <= 12 && a > 0 && b > 0 a > 0 a <= 12 && b <= 12 && a > 0 && b > 0 a <= 12 a 12 b <= 12 b 12 a > 0 a 0 b > 0 b 0 {
			sb.append("AMBIGUOUS");
		} sb.append("AMBIGUOUS") sb.append sb "AMBIGUOUS" if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		} a <= 12 && a > 0 a <= 12 a 12 a > 0 a 0 {
			sb.append("MMYY");
		} sb.append("MMYY") sb.append sb "MMYY" if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		} b <= 12 && b > 0 b <= 12 b 12 b > 0 b 0 {
			sb.append("YYMM");
		} sb.append("YYMM") sb.append sb "YYMM" {
			sb.append("NA");
		} sb.append("NA") sb.append sb "NA" System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a <= 12 && b <= 12 && a > 0 && b > 0) {
			sb.append("AMBIGUOUS");
		} else if (a <= 12 && a > 0) {
			sb.append("MMYY");
		} else if (b <= 12 && b > 0) {
			sb.append("YYMM");
		} else {
			sb.append("NA");
		}
		System.out.println(sb);
	}
}
