import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.next(); s stdIn.next() stdIn.next stdIn String initial = s.substring(0,2); initial s.substring(0,2) s.substring s 0 2 int a = Integer.parseInt(initial); a Integer.parseInt(initial) Integer.parseInt Integer initial String finish = s.substring(2,4); finish s.substring(2,4) s.substring s 2 4 int b = Integer.parseInt(finish); b Integer.parseInt(finish) Integer.parseInt Integer finish if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= a && a<= 12  && 1 <= b && b<= 12 1 <= b 1 <= a && a<= 12  && 1 <= b && b<= 12 1 <= a 1 a a<= 12 a 12 1 <= b 1 b b<= 12 b 12 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= a && a<= 12 1 <= a 1 a a<= 12 a 12 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= b && b<= 12 1 <= b 1 b b<= 12 b 12 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		String initial = s.substring(0,2);
		
		int a = Integer.parseInt(initial); //前2文字を数字化
		
		String finish = s.substring(2,4);
		int b = Integer.parseInt(finish); //後ろ2文字を数字化
		
		
		if(1 <= a && a<= 12  && 1 <= b && b<= 12 ) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= a && a<= 12 ) {
			System.out.println("MMYY");
		}else if(1 <= b && b<= 12 ){
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
			
			
			
		
		
		
		
	}

}
