import java.util.Scanner;

/**
 * @author yamino
 *
 */
public class Main {
	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	}
} Main public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	} main {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String tmp = sc.next(); tmp sc.next() sc.next sc sc.close() sc.close sc StringBuffer sb = new StringBuffer(tmp); sb new StringBuffer(tmp) int num1 = Integer.parseInt(sb.substring(0, 2)); num1 Integer.parseInt(sb.substring(0, 2)) Integer.parseInt Integer sb.substring(0, 2) sb.substring sb 0 2 int num2 = Integer.parseInt(sb.substring(2, 4)); num2 Integer.parseInt(sb.substring(2, 4)) Integer.parseInt Integer sb.substring(2, 4) sb.substring sb 2 4 if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		} num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1 num1 >=1 num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1 num1 <= 12 num1 12 num2 <= 12 num2 12 num1 >=1 num1 1 num2 >=1 num2 1 {
			System.out.println("AMBIGUOUS");
			return;
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		} num1 <= 12 && num1 >= 1 num1 <= 12 num1 12 num1 >= 1 num1 1 {
			System.out.println("MMYY");
			return;
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		} num2 <= 12 && num2 >= 1 num2 <= 12 num2 12 num2 >= 1 num2 1 {
			System.out.println("YYMM");
			return;
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; {
			System.out.println("NA");
			return;
		} System.out.println("NA") System.out.println System.out System System.out "NA" return; String[] args args public class Main {
	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	}
} public class Main {
	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	}
} Main
import java.util.Scanner;

/**
 * @author yamino
 *
 */
public class Main {
	public static void main(String[] args) {
		//入力
		Scanner sc = new Scanner(System.in);
		String tmp = sc.next();
		sc.close();
		//整形
		StringBuffer sb = new StringBuffer(tmp);
		int num1 = Integer.parseInt(sb.substring(0, 2));
		int num2 = Integer.parseInt(sb.substring(2, 4));

		//分岐
		if(num1 <= 12 && num2 <= 12 && num1 >=1 && num2 >=1) {
			System.out.println("AMBIGUOUS");
			return;
		}else if(num1 <= 12 && num1 >= 1) {
			System.out.println("MMYY");
			return;
		}else if(num2 <= 12 && num2 >= 1) {
			System.out.println("YYMM");
			return;
		}else {
			System.out.println("NA");
			return;
		}
	}
}