import java.util.*;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    }
    
    public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    }
    
    public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    }
    
    public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    }
    
    public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    } main {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String Y = sc.next(); Y sc.next() sc.next sc String[] A = new String[2]; A new String[2] 2 A[0] = Y.substring(0,2) A[0] A 0 Y.substring(0,2) Y.substring Y 0 2 A[1] = Y.substring(2,4) A[1] A 1 Y.substring(2,4) Y.substring Y 2 4 System.out.println(judgement(A)) System.out.println System.out System System.out judgement(A) judgement A String[] args args public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    } judgement {
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    } int bef = Integer.parseInt(Application[0]); bef Integer.parseInt(Application[0]) Integer.parseInt Integer Application[0] Application 0 int aft = Integer.parseInt(Application[1]); aft Integer.parseInt(Application[1]) Integer.parseInt Integer Application[1] Application 1 int befres = bunki(bef); befres bunki(bef) bunki bef int aftres = bunki(aft); aftres bunki(aft) bunki aft String result = ""; result "" if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 0 && aftres == 0 befres == 0 befres 0 aftres == 0 aftres 0 {
            result = "NA";
        } result = "NA" result "NA" if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 0 && aftres == 1 befres == 0 befres 0 aftres == 1 aftres 1 {
            result = "YYMM";
        } result = "YYMM" result "YYMM" if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 1 && aftres == 0 befres == 1 befres 1 aftres == 0 aftres 0 {
            result = "MMYY";
        } result = "MMYY" result "MMYY" if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 1 && aftres == 1 befres == 1 befres 1 aftres == 1 aftres 1 {
            result = "AMBIGUOUS";
        } result = "AMBIGUOUS" result "AMBIGUOUS" if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 2 && aftres == 1 befres == 2 befres 2 aftres == 1 aftres 1 {
            result = "YYMM";
        } result = "YYMM" result "YYMM" if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 1 && aftres == 2 befres == 1 befres 1 aftres == 2 aftres 2 {
            result = "MMYY";
        } result = "MMYY" result "MMYY" if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 2 && aftres == 2 befres == 2 befres 2 aftres == 2 aftres 2 {
            result = "NA";
        } result = "NA" result "NA" if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 2 && aftres == 0 befres == 2 befres 2 aftres == 0 aftres 0 {
            result = "NA";
        } result = "NA" result "NA" if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        } befres == 0 && aftres == 2 befres == 0 befres 0 aftres == 2 aftres 2 {
            result = "NA";
        } result = "NA" result "NA" {
            result = "MMYY";
        } result = "MMYY" result "MMYY" return result; result String[] Application Application public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    } bunki {
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    } int resnum = 0; resnum 0 if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        } num == 00 num 00 {
            resnum = 0;
        } resnum = 0 resnum 0 if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        } 0 < num && num <= 12 0 < num 0 num num <= 12 num 12 {
            resnum = 1;
        } resnum = 1 resnum 1 if(num > 12){
            resnum = 2;       
        } num > 12 num 12 {
            resnum = 2;       
        } resnum = 2 resnum 2 return resnum; resnum int num num public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    }
    
    public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    }
    
    public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    }
    
    public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    }
    
    public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String Y = sc.next();
        String[] A = new String[2];
        A[0] = Y.substring(0,2);
        A[1] = Y.substring(2,4);
        
        System.out.println(judgement(A));    
        
    }
    
    public static String judgement(String[] Application){
        int bef = Integer.parseInt(Application[0]);
        int aft = Integer.parseInt(Application[1]);
        int befres = bunki(bef);
        int aftres = bunki(aft);
        String result = "";
        
        if(befres == 0 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 0){
            result = "MMYY";
        }else if(befres == 1 && aftres == 1){
            result = "AMBIGUOUS";
        }else if(befres == 2 && aftres == 1){
            result = "YYMM";
        }else if(befres == 1 && aftres == 2){
            result = "MMYY";
        }else if(befres == 2 && aftres == 2){
            result = "NA";
        }else if(befres == 2 && aftres == 0){
            result = "NA";
        }else if(befres == 0 && aftres == 2){
            result = "NA";
        }else{
            result = "MMYY";
        }
        
        return result;
    }
    
    public static int bunki(int num){
        int resnum = 0;
        if(num == 00){
            resnum = 0;
        }else if(0 < num && num <= 12){
            resnum = 1;
        }else if(num > 12){
            resnum = 2;       
        }
        return resnum;
    }
}