import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 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();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM";
		
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM";
		
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 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 String sb1 = s.substring(0, 2); sb1 s.substring(0, 2) s.substring s 0 2 String sb2 = s.substring(2); sb2 s.substring(2) s.substring s 2 int first = Integer.parseInt(sb1); first Integer.parseInt(sb1) Integer.parseInt Integer sb1 int second = Integer.parseInt(sb2); second Integer.parseInt(sb2) Integer.parseInt Integer sb2 String ans = "NA"; ans "NA" if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM"; first > 0 && first <= 12 && second > 0 && second <= 12 second > 0 first > 0 && first <= 12 && second > 0 && second <= 12 first > 0 first 0 first <= 12 first 12 second > 0 second 0 second <= 12 second 12 ans = "AMBIGUOUS" ans "AMBIGUOUS" if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM"; first > 0 && first <= 12 first > 0 first 0 first <= 12 first 12 ans = "MMYY" ans "MMYY" if(second > 0 && second <= 12) ans = "YYMM"; second > 0 && second <= 12 second > 0 second 0 second <= 12 second 12 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();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 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();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM";
		
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String sb1 = s.substring(0, 2);
		String sb2 = s.substring(2);
		
		int first = Integer.parseInt(sb1);
		int second = Integer.parseInt(sb2);
		
		String ans = "NA";
		if(first > 0 && first <= 12 && second > 0 && second <= 12) ans = "AMBIGUOUS";
		else if(first > 0 && first <= 12) ans = "MMYY";
		else if(second > 0 && second <= 12) ans = "YYMM";
		
		System.out.println(ans);
	}
}