import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans;
        if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        }
        
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans;
        if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        }
        
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans;
        if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        }
        
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans;
        if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            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[] s = S.split(""); s S.split("") S.split S "" int[] n = new int[4]; n new int[4] 4 for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            n[i] = Integer.parseInt(s[i]);
        } {
            n[i] = Integer.parseInt(s[i]);
        } n[i] = Integer.parseInt(s[i]) n[i] n i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i String ans; ans if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        } 1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12 1 <= n[3] 1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12 1 <= n[1] 1 n[1] n 1 n[0]*10+n[1] <= 12 n[0]*10+n[1] n[0]*10 n[0] n 0 10 n[1] n 1 12 1 <= n[3] 1 n[3] n 3 n[2]*10+n[3] <= 12 n[2]*10+n[3] n[2]*10 n[2] n 2 10 n[3] n 3 12 {
            ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        } 1 <= n[1] && n[0]*10+n[1] <= 12 1 <= n[1] 1 n[1] n 1 n[0]*10+n[1] <= 12 n[0]*10+n[1] n[0]*10 n[0] n 0 10 n[1] n 1 12 {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        } 1 <= n[3] && n[2]*10+n[3] <= 12 1 <= n[3] 1 n[3] n 3 n[2]*10+n[3] <= 12 n[2]*10+n[3] n[2]*10 n[2] n 2 10 n[3] n 3 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
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int[] n = new int[4];
        for(int i = 0; i < 4; i++) {
            n[i] = Integer.parseInt(s[i]);
        }
        
        String ans;
        if(1 <= n[1] && n[0]*10+n[1] <= 12 && 1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "AMBIGUOUS";
        }else if(1 <= n[1] && n[0]*10+n[1] <= 12) {
            ans = "MMYY";
        }else if(1 <= n[3] && n[2]*10+n[3] <= 12) {
            ans = "YYMM";
        }else {
            ans = "NA";
        }
        
        System.out.println(ans);
    }
}