import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    } main {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    } Scanner sc = new  Scanner(System.in); sc new  Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String left = str.substring(0,2); left str.substring(0,2) str.substring str 0 2 String right = str.substring(2,4); right str.substring(2,4) str.substring str 2 4 String massage = "NA"; massage "NA" if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        } Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12 Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12 Integer.parseInt(left) >= 0 Integer.parseInt(left) Integer.parseInt Integer left 0 Integer.parseInt(right) >= 1 Integer.parseInt(right) Integer.parseInt Integer right 1 Integer.parseInt(right) <= 12 Integer.parseInt(right) Integer.parseInt Integer right 12 {
            massage = "YYMM";
        } massage = "YYMM" massage "YYMM" if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        } Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12 Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12 Integer.parseInt(right) >= 0 Integer.parseInt(right) Integer.parseInt Integer right 0 Integer.parseInt(left) >= 1 Integer.parseInt(left) Integer.parseInt Integer left 1 Integer.parseInt(left) <= 12 Integer.parseInt(left) Integer.parseInt Integer left 12 {
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        } if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            } massage.equals("YYMM") massage.equals massage "YYMM" {
                massage = "AMBIGUOUS";
            } massage = "AMBIGUOUS" massage "AMBIGUOUS" {
                massage = "MMYY";
            } massage = "MMYY" massage "MMYY" System.out.println(massage) System.out.println System.out System System.out massage sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        String str = sc.next();

        String left = str.substring(0,2);
        String right = str.substring(2,4);

        String massage = "NA";
        if (Integer.parseInt(left) >= 0  &&
        Integer.parseInt(right) >= 1 && Integer.parseInt(right) <= 12){
            massage = "YYMM";
        }
        if (Integer.parseInt(right) >= 0  &&
        Integer.parseInt(left) >= 1 && Integer.parseInt(left) <= 12){
            if(massage.equals("YYMM")){
                massage = "AMBIGUOUS";
            } else {
                massage = "MMYY";
            }
        }
        System.out.println(massage);
        sc.close();
    }
}