import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
} 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.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine 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 b = Integer.parseInt(s.substring(2)); b Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		} isMon(a) isMon a {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY"); isMon(b) isMon b System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		} if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA"); isMon(b) isMon b System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	} isMon {
		return x >= 1 && x <= 12;
	} return x >= 1 && x <= 12; x >= 1 && x <= 12 x >= 1 x 1 x <= 12 x 12 int x x public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
}
