import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	}

	/**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	}

	/**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		} {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner 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 b = Integer.parseInt(s.substring(2)); b Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			} isMonth(a) isMonth a {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				} isMonth(b) isMonth b {
					System.out.println("AMBIGUOUS");
				} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
					System.out.println("MMYY");
				} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			} if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				} isMonth(b) isMonth b {
					System.out.println("YYMM");
				} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
					System.out.println("NA");
				} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args /**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	} isMonth {
		return (n >= 1) && (n <= 12);
	} return (n >= 1) && (n <= 12); (n >= 1) && (n <= 12) (n >= 1) n 1 (n <= 12) n 12 int n n public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	}

	/**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	}

	/**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
			if (isMonth(a)) {
				if (isMonth(b)) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (isMonth(b)) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}
		}
	}

	/**
	 * nが月の数になれるかを返す
	 * 
	 * @param n
	 * @return nが月の数になれるか
	 */
	private static boolean isMonth(int n) {
		return (n >= 1) && (n <= 12);
	}
}
