import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 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 scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String head = s.substring(0,2); head s.substring(0,2) s.substring s 0 2 String tail = s.substring(2,4); tail s.substring(2,4) s.substring s 2 4 int intHead = Integer.parseInt(head); intHead Integer.parseInt(head) Integer.parseInt Integer head int intTail = Integer.parseInt(tail); intTail Integer.parseInt(tail) Integer.parseInt Integer tail if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12 1 <= intTail 1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12 1 <= intHead 1 intHead intHead <= 12 intHead 12 1 <= intTail 1 intTail intTail <= 12 intTail 12 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= intHead && intHead <= 12 1 <= intHead 1 intHead intHead <= 12 intHead 12 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} 1 <= intTail && intTail <= 12 1 <= intTail 1 intTail intTail <= 12 intTail 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 scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 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 scan = new Scanner(System.in);
		String s = scan.next();
		String head = s.substring(0,2);
		String tail = s.substring(2,4);

		int intHead = Integer.parseInt(head);
		int intTail = Integer.parseInt(tail);

		if(1 <= intHead && intHead <= 12 && 1 <= intTail && intTail <= 12) {
			System.out.println("AMBIGUOUS");
		}else if(1 <= intHead && intHead <= 12) {
			System.out.println("MMYY");
		}else if(1 <= intTail && intTail <= 12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
}
