import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc077/tasks/arc084_b
 */
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(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.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		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 sc.close() sc.close sc int a = Integer.parseInt(S.substring(0,2)); a Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 int b = Integer.parseInt(S.substring(2,4)); b Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 String ans = "NA"; ans "NA" if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		} a>0 && a<=12 && b>0 && b<=12 b>0 a>0 && a<=12 && b>0 && b<=12 a>0 a 0 a<=12 a 12 b>0 b 0 b<=12 b 12 {
			ans = "AMBIGUOUS";
		} ans = "AMBIGUOUS" ans "AMBIGUOUS" if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		} a>0 && a<=12 a>0 a 0 a<=12 a 12 {
			ans = "MMYY";
		} ans = "MMYY" ans "MMYY" if(b>0 && b<=12) {
			ans = "YYMM";
		} b>0 && b<=12 b>0 b 0 b<=12 b 12 {
			ans = "YYMM";
		} ans = "YYMM" ans "YYMM" 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) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}

} Main
import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc077/tasks/arc084_b
 */
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}

}