import java.util.Scanner;

//AtCoder Beginner Contest 126
//B	YYMM or MMYY
public class Main {

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

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	}
} 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.nextLine();

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc sc.close() sc.close sc int a = Integer.valueOf(S.substring(0, 2)).intValue(); a Integer.valueOf(S.substring(0, 2)).intValue() Integer.valueOf(S.substring(0, 2)).intValue Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 int b = Integer.valueOf(S.substring(2)).intValue(); b Integer.valueOf(S.substring(2)).intValue() Integer.valueOf(S.substring(2)).intValue Integer.valueOf(S.substring(2)) Integer.valueOf Integer S.substring(2) S.substring S 2 boolean aIsMonth = (a > 0 && a < 13); aIsMonth (a > 0 && a < 13) a > 0 a 0 a < 13 a 13 boolean bIsMonth = (b > 0 && b < 13); bIsMonth (b > 0 && b < 13) b > 0 b 0 b < 13 b 13 String ans = "NA"; ans "NA" if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		} aIsMonth {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			} bIsMonth {
				ans = "AMBIGUOUS";
			} ans = "AMBIGUOUS" ans "AMBIGUOUS" {
				ans = "MMYY";
			} ans = "MMYY" ans "MMYY" {
			if (bIsMonth) {
				ans = "YYMM";
			}
		} if (bIsMonth) {
				ans = "YYMM";
			} bIsMonth {
				ans = "YYMM";
			} ans = "YYMM" ans "YYMM" System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main {

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

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	}
} public class Main {

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

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	}
} Main
import java.util.Scanner;

//AtCoder Beginner Contest 126
//B	YYMM or MMYY
public class Main {

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

		sc.close();

		int a = Integer.valueOf(S.substring(0, 2)).intValue();
		int b = Integer.valueOf(S.substring(2)).intValue();

		boolean aIsMonth = (a > 0 && a < 13);
		boolean bIsMonth = (b > 0 && b < 13);

		String ans = "NA";
		if (aIsMonth) {
			if (bIsMonth) {
				ans = "AMBIGUOUS";
			} else {
				ans = "MMYY";
			}
		} else {
			if (bIsMonth) {
				ans = "YYMM";
			}
		}

		System.out.print(ans);
	}
}
