import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=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) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	}

} Main public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	} main {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	} String S; S Scanner sc = new Scanner(System.in); sc new Scanner(System.in) S = sc.next() S sc.next() sc.next sc String s=""; s "" int n n m; m s=s+String.valueOf(S.charAt(0)) s s+String.valueOf(S.charAt(0)) s String.valueOf(S.charAt(0)) String.valueOf String S.charAt(0) S.charAt S 0 s=s+String.valueOf(S.charAt(1)) s s+String.valueOf(S.charAt(1)) s String.valueOf(S.charAt(1)) String.valueOf String S.charAt(1) S.charAt S 1 n=Integer.parseInt(s) n Integer.parseInt(s) Integer.parseInt Integer s s="" s "" s=s+String.valueOf(S.charAt(2)) s s+String.valueOf(S.charAt(2)) s String.valueOf(S.charAt(2)) String.valueOf String S.charAt(2) S.charAt S 2 s=s+String.valueOf(S.charAt(3)) s s+String.valueOf(S.charAt(3)) s String.valueOf(S.charAt(3)) String.valueOf String S.charAt(3) S.charAt S 3 m=Integer.parseInt(s) m Integer.parseInt(s) Integer.parseInt Integer s if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA"); 1<=n&&n<=12 1<=n 1 n n<=12 n 12 {
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		} if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			} 1<=m&&m<=12 1<=m 1 m m<=12 m 12 {
				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(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA"); 1<=m&&m<=12 1<=m 1 m m<=12 m 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 System.out System System.out "NA" String[] args args public class Main {

	public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	}

} public class Main {

	public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		String s="";
		int n,m;
		s=s+String.valueOf(S.charAt(0));
		s=s+String.valueOf(S.charAt(1));
		n=Integer.parseInt(s);
		s="";
		s=s+String.valueOf(S.charAt(2));
		s=s+String.valueOf(S.charAt(3));
		m=Integer.parseInt(s);
		if(1<=n&&n<=12){
			if(1<=m&&m<=12){
				System.out.println("AMBIGUOUS");
			}
			else{
				System.out.println("MMYY");
			}
		}
		else if(1<=m&&m<=12){
			System.out.println("YYMM");
		}
		else
			System.out.println("NA");
	}

}