import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	}
} Main public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	} main {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	} try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		} {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		} Scanner s = new Scanner(System.in) Scanner s = new Scanner(System.in) new Scanner(System.in) final String S = s.next(); S s.next() s.next s int aa = Integer.parseInt(S.substring(0, 2)); aa Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int bb = Integer.parseInt(S.substring(2, 4)); bb Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 String ret; ret if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			} 1 <= aa && aa <= 12 1 <= aa 1 aa aa <= 12 aa 12 {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				} 1 <= bb && bb <= 12 1 <= bb 1 bb bb <= 12 bb 12 {
					ret = "AMBIGUOUS";
				} ret = "AMBIGUOUS" ret "AMBIGUOUS" {
					ret = "MMYY";
				} ret = "MMYY" ret "MMYY" {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			} if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				} 1 <= bb && bb <= 12 1 <= bb 1 bb bb <= 12 bb 12 {
					ret = "YYMM";
				} ret = "YYMM" ret "YYMM" {
					ret = "NA";
				} ret = "NA" ret "NA" System.out.println(ret) System.out.println System.out System System.out ret String[] args args public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final String S = s.next();
			int aa = Integer.parseInt(S.substring(0, 2));
			int bb = Integer.parseInt(S.substring(2, 4));

			String ret;
			if (1 <= aa && aa <= 12) {
				// MMbb
				if (1 <= bb && bb <= 12) {
					ret = "AMBIGUOUS";
				} else {
					ret = "MMYY";
				}
			} else {
				// YYbb
				if (1 <= bb && bb <= 12) {
					ret = "YYMM";
				} else {
					ret = "NA";
				}
			}
			System.out.println(ret);
		}
	}
}
