
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz