import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String a = scan.next(); a scan.next() scan.next scan int b=0 b 0 c=0; c 0 String ans; ans if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		} Character.getNumericValue(a.charAt(0))!=0 Character.getNumericValue(a.charAt(0)) Character.getNumericValue Character a.charAt(0) a.charAt a 0 0 {
			b+=Character.getNumericValue(a.charAt(0))*10;
		} b+=Character.getNumericValue(a.charAt(0))*10 b Character.getNumericValue(a.charAt(0))*10 Character.getNumericValue(a.charAt(0)) Character.getNumericValue Character a.charAt(0) a.charAt a 0 10 b+=Character.getNumericValue(a.charAt(1)) b Character.getNumericValue(a.charAt(1)) Character.getNumericValue Character a.charAt(1) a.charAt a 1 if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		} Character.getNumericValue(a.charAt(2))!=0 Character.getNumericValue(a.charAt(2)) Character.getNumericValue Character a.charAt(2) a.charAt a 2 0 {
			c+=Character.getNumericValue(a.charAt(2))*10;
		} c+=Character.getNumericValue(a.charAt(2))*10 c Character.getNumericValue(a.charAt(2))*10 Character.getNumericValue(a.charAt(2)) Character.getNumericValue Character a.charAt(2) a.charAt a 2 10 c+=Character.getNumericValue(a.charAt(3)) c Character.getNumericValue(a.charAt(3)) Character.getNumericValue Character a.charAt(3) a.charAt a 3 if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		} b>=1&&b<=12&&c>=1&&c<=12 c>=1 b>=1&&b<=12&&c>=1&&c<=12 b>=1 b 1 b<=12 b 12 c>=1 c 1 c<=12 c 12 {
			ans="AMBIGUOUS";
		} ans="AMBIGUOUS" ans "AMBIGUOUS" if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		} b>=1&&b<=12 b>=1 b 1 b<=12 b 12 {
			ans="MMYY";
		} ans="MMYY" ans "MMYY" if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		} c>=1&&c<=12 c>=1 c 1 c<=12 c 12 {
			ans="YYMM";
		} ans="YYMM" ans "YYMM" {
			ans="NA";
		} ans="NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		int b=0,c=0;
		String ans;
		if(Character.getNumericValue(a.charAt(0))!=0){
			b+=Character.getNumericValue(a.charAt(0))*10;
		}b+=Character.getNumericValue(a.charAt(1));
		if(Character.getNumericValue(a.charAt(2))!=0){
			c+=Character.getNumericValue(a.charAt(2))*10;
		}c+=Character.getNumericValue(a.charAt(3));
		if(b>=1&&b<=12&&c>=1&&c<=12){
			ans="AMBIGUOUS";
		}else if(b>=1&&b<=12){
			ans="MMYY";
		}else if(c>=1&&c<=12){
			ans="YYMM";
		}else{
			ans="NA";
		}
		System.out.println(ans);
	}
}