import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}

/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