import java.util.Scanner;

public class Main {

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

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	} main {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String t = S.substring(0, 2); t S.substring(0, 2) S.substring S 0 2 String k = S.substring(2); k S.substring(2) S.substring S 2 int a = Integer.parseInt(t); a Integer.parseInt(t) Integer.parseInt Integer t int b = Integer.parseInt(k); b Integer.parseInt(k) Integer.parseInt Integer k String s; s if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		} (1 <= a && a <= 12) && (1 <= b && b <= 12) (1 <= a && a <= 12) 1 <= a 1 a a <= 12 a 12 (1 <= b && b <= 12) 1 <= b 1 b b <= 12 b 12 {
			s = "AMBIGUOUS";
		} s = "AMBIGUOUS" s "AMBIGUOUS" if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		} (1 <= a && a <= 12) && (13 <= b || b == 0) (1 <= a && a <= 12) 1 <= a 1 a a <= 12 a 12 (13 <= b || b == 0) 13 <= b 13 b b == 0 b 0 {
			s = "MMYY";
		} s = "MMYY" s "MMYY" if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		} (a >= 13 || a == 0) && (1 <= b && b <= 12) (a >= 13 || a == 0) a >= 13 a 13 a == 0 a 0 (1 <= b && b <= 12) 1 <= b 1 b b <= 12 b 12 {
			s = "YYMM";
		} s = "YYMM" s "YYMM" {
			s = "NA";
		} s = "NA" s "NA" System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		String t = S.substring(0, 2);
		String k = S.substring(2);
		int a = Integer.parseInt(t);
		int b = Integer.parseInt(k);
		String s;
		if ((1 <= a && a <= 12) && (1 <= b && b <= 12)) {
			s = "AMBIGUOUS";
		} else if ((1 <= a && a <= 12) && (13 <= b || b == 0)) {
			s = "MMYY";
		} else if ((a >= 13 || a == 0) && (1 <= b && b <= 12)) {
			s = "YYMM";
		} else {
			s = "NA";
		}
		System.out.println(s);
	}
}