import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String s1 s1 s2; s2 s1 = s2 = "" s1 s2 = "" s2 "" for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		} int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		} {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		} s1 += s.charAt(i) s1 s.charAt(i) s.charAt s i s2 += s.charAt(i + 2) s2 s.charAt(i + 2) s.charAt s i + 2 i 2 int a = Integer.valueOf(s1); a Integer.valueOf(s1) Integer.valueOf Integer s1 int b = Integer.valueOf(s2); b Integer.valueOf(s2) Integer.valueOf Integer s2 if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		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 System.out System System.out "AMBIGUOUS" if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA"); a < 13 && a > 0 a < 13 a 13 a > 0 a 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA"); b < 13 && b > 0 b < 13 b 13 b > 0 b 0 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1, s2;
		s1 = s2 = "";
		for(int i = 0; i < 2; i++) {
			s1 += s.charAt(i);
			s2 += s.charAt(i + 2);
		}

		int a = Integer.valueOf(s1);
		int b = Integer.valueOf(s2);

		if(a < 13 && b < 13 && a > 0 && b > 0) System.out.println("AMBIGUOUS");
		else if(a < 13 && a > 0) System.out.println("MMYY");
		else if(b < 13 && b > 0) System.out.println("YYMM");
		else System.out.println("NA");

		sc.close();
	}
}
