import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	} main {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc int pre = Integer.valueOf(str.substring(0, 2)); pre Integer.valueOf(str.substring(0, 2)) Integer.valueOf Integer str.substring(0, 2) str.substring str 0 2 int bef = Integer.valueOf(str.substring(2, 4)); bef Integer.valueOf(str.substring(2, 4)) Integer.valueOf Integer str.substring(2, 4) str.substring str 2 4 if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		} pre > 12 || pre == 0 pre > 12 pre 12 pre == 0 pre 0 {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			} bef > 12 || bef == 0 bef > 12 bef 12 bef == 0 bef 0 {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		} bef > 12 || bef == 0 bef > 12 bef 12 bef == 0 bef 0 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String str = sc.next();

		int pre = Integer.valueOf(str.substring(0, 2));
		int bef = Integer.valueOf(str.substring(2, 4));

		if (pre > 12 || pre == 0) {
			if (bef > 12 || bef == 0) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else if (bef > 12 || bef == 0) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
}