import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String ans = ""; ans "" int left = Integer.parseInt(S.substring(0,2)); left Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 int right = Integer.parseInt(S.substring(2,4)); right Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		} (left>0&&left<13)&&(right>0&&right<13) (left>0&&left<13) left>0 left 0 left<13 left 13 (right>0&&right<13) right>0 right 0 right<13 right 13 {
			ans = "AMBIGUOUS";
		} ans = "AMBIGUOUS" ans "AMBIGUOUS" if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		} (left==0 ||left>12) && (right<=12 && right>0) (left==0 ||left>12) left==0 left 0 left>12 left 12 (right<=12 && right>0) right<=12 right 12 right>0 right 0 {
			ans = "YYMM";
		} ans = "YYMM" ans "YYMM" if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		} (left<=12 && left>0) && (right==0 || right>12) (left<=12 && left>0) left<=12 left 12 left>0 left 0 (right==0 || right>12) right==0 right 0 right>12 right 12 {
			ans = "MMYY";
		} ans = "MMYY" ans "MMYY" {
			ans = "NA";
		} ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String ans = "";

		int left = Integer.parseInt(S.substring(0,2));
		int right = Integer.parseInt(S.substring(2,4));


		if ((left>0&&left<13)&&(right>0&&right<13)) {
			ans = "AMBIGUOUS";
		} else if ((left==0 ||left>12) && (right<=12 && right>0)) {
			ans = "YYMM";
		} else if ((left<=12 && left>0) && (right==0 || right>12)) {
			ans = "MMYY";
		} else {
			ans = "NA";
		}
		System.out.println(ans);
	}

}
