import java.util.*;
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    }
} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    } main {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String S1 =""; S1 "" String S2 =""; S2 "" String ans=""; ans "" int cnt1 = 0; cnt1 0 int cnt2 = 0; cnt2 0 int i1 = 0; i1 0 int i2 = 0; i2 0 S1=S.substring(0, 2) S1 S.substring(0, 2) S.substring S 0 2 S2=S.substring(2, 4) S2 S.substring(2, 4) S.substring S 2 4 i1 = Integer.parseInt(S1) i1 Integer.parseInt(S1) Integer.parseInt Integer S1 i2 = Integer.parseInt(S2) i2 Integer.parseInt(S2) Integer.parseInt Integer S2 for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		} int i=1; int i=1; i 1 i<=12 i 12 i++ i++ i {
			if (i1==i) {
				cnt1= cnt1+1;
			}
		} {
			if (i1==i) {
				cnt1= cnt1+1;
			}
		} if (i1==i) {
				cnt1= cnt1+1;
			} i1==i i1 i {
				cnt1= cnt1+1;
			} cnt1= cnt1+1 cnt1 cnt1+1 cnt1 1 for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		} int j=1; int j=1; j 1 j<=12 j 12 j++ j++ j {
			if (i2==j) {
				cnt2=cnt2+1;
			}
		} {
			if (i2==j) {
				cnt2=cnt2+1;
			}
		} if (i2==j) {
				cnt2=cnt2+1;
			} i2==j i2 j {
				cnt2=cnt2+1;
			} cnt2=cnt2+1 cnt2 cnt2+1 cnt2 1 if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		} cnt1==1&&cnt2==1 cnt1==1 cnt1 1 cnt2==1 cnt2 1 {
			ans="AMBIGUOUS";
			System.out.println(ans);
		} ans="AMBIGUOUS" ans "AMBIGUOUS" System.out.println(ans) System.out.println System.out System System.out ans if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		} cnt1==1&&cnt2!=1 cnt1==1 cnt1 1 cnt2!=1 cnt2 1 {
			ans="MMYY";
			System.out.println(ans);
		} ans="MMYY" ans "MMYY" System.out.println(ans) System.out.println System.out System System.out ans if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		} cnt1!=1&&cnt2==1 cnt1!=1 cnt1 1 cnt2==1 cnt2 1 {
			ans="YYMM";
			System.out.println(ans);
		} ans="YYMM" ans "YYMM" System.out.println(ans) System.out.println System.out System System.out ans if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		} cnt1!=1&&cnt2!=1 cnt1!=1 cnt1 1 cnt2!=1 cnt2 1 {
			ans="NA";
			System.out.println(ans);
		} 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 sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    }
} public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    }
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S1 ="";
		String S2 ="";
		String ans="";
		int cnt1 = 0;
		int cnt2 = 0;
		int i1 = 0;
		int i2 = 0;
		S1=S.substring(0, 2);
		S2=S.substring(2, 4);
		i1 = Integer.parseInt(S1);
		i2 = Integer.parseInt(S2);
		for(int i=1;i<=12;i++){
			if (i1==i) {
				cnt1= cnt1+1;
			}
		}	
		for(int j=1;j<=12;j++){
			if (i2==j) {
				cnt2=cnt2+1;
			}
		}
		if (cnt1==1&&cnt2==1) {
			ans="AMBIGUOUS";
			System.out.println(ans);
		}
		if (cnt1==1&&cnt2!=1) {
			ans="MMYY";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2==1) {
			ans="YYMM";
			System.out.println(ans);
		}
		if (cnt1!=1&&cnt2!=1) {
			ans="NA";
			System.out.println(ans);
		}
    }
}