import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	}
	public static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	}
} import java.io.FileNotFoundException; FileNotFoundException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	}
	public static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	}
} Main public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	} main {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc String S1 = S.substring(0, 2); S1 S.substring(0, 2) S.substring S 0 2 String S2 = S.substring(2, 4); S2 S.substring(2, 4) S.substring S 2 4 if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		} isMM(S1) isMM S1 {
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			} isMM(S2) isMM S2 {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		} if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} isMM(S2) isMM S2 {
				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 static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	} isMM {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	} int month = Integer.parseInt(S); month Integer.parseInt(S) Integer.parseInt Integer S if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		} month>=1&&month<=12 month>=1 month 1 month<=12 month 12 {
			return true;
		} return true; true {
			return false;
		} return false; false String S S public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	}
	public static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	}
} public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	}
	public static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	}
} Main
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();
		String S1 = S.substring(0, 2);
		String S2 = S.substring(2, 4);

		if(isMM(S1)){
			if(isMM(S2)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if(isMM(S2)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}


	}
	public static boolean isMM(String S) {
		int month = Integer.parseInt(S);
		if (month>=1&&month<=12) {
			return true;
		} else {
			return false;
		}
	}
}