import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String YYMM = sc.nextLine(); YYMM sc.nextLine() sc.nextLine sc int flag = 0; flag 0 int YY = Integer.parseInt(YYMM.substring(0,2)); YY Integer.parseInt(YYMM.substring(0,2)) Integer.parseInt Integer YYMM.substring(0,2) YYMM.substring YYMM 0 2 int MM = Integer.parseInt(YYMM.substring(2)); MM Integer.parseInt(YYMM.substring(2)) Integer.parseInt Integer YYMM.substring(2) YYMM.substring YYMM 2 if(YY > 12 || YY < 1){
            flag = -1;
        } YY > 12 || YY < 1 YY > 12 YY 12 YY < 1 YY 1 {
            flag = -1;
        } flag = -1 flag -1 1 if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        } MM > 12 || MM < 1 MM > 12 MM 12 MM < 1 MM 1 {
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        } if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            } flag != -1 flag -1 1 {
                flag += 1;
            } flag += 1 flag 1 {
                flag = 2;
            } flag = 2 flag 2 if(YYMM.equals("0000")){
            flag = 2;
        } YYMM.equals("0000") YYMM.equals YYMM "0000" {
            flag = 2;
        } flag = 2 flag 2 switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        } flag case 0: 0 case 0: System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" break; case 1: 1 case 1: System.out.println("MMYY") System.out.println System.out System System.out "MMYY" break; case -1: -1 1 case -1: System.out.println("YYMM") System.out.println System.out System System.out "YYMM" break; case 2: 2 case 2: System.out.println("NA") System.out.println System.out System System.out "NA" break; String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String YYMM = sc.nextLine();
        int flag = 0;
        int YY = Integer.parseInt(YYMM.substring(0,2));
        int MM = Integer.parseInt(YYMM.substring(2));

        if(YY > 12 || YY < 1){
            flag = -1;
        }
        
        if(MM > 12 || MM < 1){
            if(flag != -1){
                flag += 1;
            }else{
                flag = 2;
            }
        }

        if(YYMM.equals("0000")){
            flag = 2;
        }

        switch(flag){
            case 0:
                System.out.println("AMBIGUOUS");
                break;
            case 1:
                System.out.println("MMYY");
                break;
            case -1:
                System.out.println("YYMM");
                break;
            case 2:
                System.out.println("NA");
                break;
        }
    }
}