import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    }
   static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    }
   static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str; str str = sc.next() str sc.next() sc.next sc char[] c = str.toCharArray(); c str.toCharArray() str.toCharArray str char[] x1 = {c[0],c[1]}; x1 {c[0],c[1]} c[0] c 0 c[1] c 1 char[] x2 = {c[2],c[3]}; x2 {c[2],c[3]} c[2] c 2 c[3] c 3 boolean b1 = check(Integer.parseInt(new String( x1))); b1 check(Integer.parseInt(new String( x1))) check Integer.parseInt(new String( x1)) Integer.parseInt Integer new String( x1) boolean b2 = check(Integer.parseInt(new String( x2))); b2 check(Integer.parseInt(new String( x2))) check Integer.parseInt(new String( x2)) Integer.parseInt Integer new String( x2) String ans = ""; ans "" if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        } b1 && b2 b1 b2 {
            ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        } b1 {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        } b2 {
            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 static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    } check {
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    } if(i > 0 && i < 13){
            return true;
        } i > 0 && i < 13 i > 0 i 0 i < 13 i 13 {
            return true;
        } return true; true return false; false int i i public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    }
   static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    }
   static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str;
        str = sc.next();
        char[] c = str.toCharArray();
        char[] x1 = {c[0],c[1]};
        char[] x2 = {c[2],c[3]};
        boolean b1 = check(Integer.parseInt(new String( x1)));
        boolean b2 = check(Integer.parseInt(new String( x2)));
        
        String ans = "";
        
        if(b1 && b2){
            ans = "AMBIGUOUS";
        }else if(b1){
            ans = "MMYY";
        }else if(b2){
            ans = "YYMM";
        }else{
            ans = "NA";
        }
        System.out.println(ans);
        
        
    }
   static boolean check(int i){
        if(i > 0 && i < 13){
            return true;
        }
        return false;
    }
}