import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String in = scan.nextLine(); in scan.nextLine() scan.nextLine scan String flont = in.substring(0,2); flont in.substring(0,2) in.substring in 0 2 String back = in.substring(2); back in.substring(2) in.substring in 2 int mae = Integer.parseInt(flont); mae Integer.parseInt(flont) Integer.parseInt Integer flont int usiro = Integer.parseInt(back); usiro Integer.parseInt(back) Integer.parseInt Integer back if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		} (mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12) (mae == 0 && usiro >12) (mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12) (mae == 0 && usiro == 0) mae == 0 mae 0 usiro == 0 usiro 0 (mae > 12 && usiro > 12) mae > 12 mae 12 usiro > 12 usiro 12 (mae == 0 && usiro >12) mae == 0 mae 0 usiro >12 usiro 12 (usiro == 0 && mae >12) usiro == 0 usiro 0 mae >12 mae 12 {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		} ((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13)) ((mae > 12) || (mae == 0)) (mae > 12) mae 12 (mae == 0) mae 0 ((usiro > 0)&&(usiro < 13)) (usiro > 0) usiro 0 (usiro < 13) usiro 13 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		} ((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13)) ((usiro > 12) || (usiro == 0)) (usiro > 12) usiro 12 (usiro == 0) usiro 0 ((mae > 0)&&(mae < 13)) (mae > 0) mae 0 (mae < 13) mae 13 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String in = scan.nextLine();
		String flont = in.substring(0,2);
		String back = in.substring(2);
		int mae = Integer.parseInt(flont);
		int usiro = Integer.parseInt(back);
		if((mae == 0 && usiro == 0) || (mae > 12 && usiro > 12) || (mae == 0 && usiro >12) || (usiro == 0 && mae >12)) {
			System.out.println("NA");
		}else if(((mae > 12) || (mae == 0))&&((usiro > 0)&&(usiro < 13))){
			System.out.println("YYMM");
		}else if(((usiro > 12) || (usiro == 0))&&((mae > 0)&&(mae < 13))) {
			System.out.println("MMYY");
		}else {
			System.out.println("AMBIGUOUS");
		}
	}
}