import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String sb = str; sb str String sNum1 = sb.substring(0, 2); sNum1 sb.substring(0, 2) sb.substring sb 0 2 String sNum2 = sb.substring(2); sNum2 sb.substring(2) sb.substring sb 2 int num1 = Integer.parseInt(sNum1); num1 Integer.parseInt(sNum1) Integer.parseInt Integer sNum1 int num2 = Integer.parseInt(sNum2); num2 Integer.parseInt(sNum2) Integer.parseInt Integer sNum2 if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12 num1 <= 12 0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12 0 < num1 0 num1 0 < num2 0 num2 num1 <= 12 num1 12 num2 <= 12 num2 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 0 < num1 && num1 <= 12 0 < num1 0 num1 num1 <= 12 num1 12 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 0 < num2 && num2 <= 12 0 < num2 0 num2 num2 <= 12 num2 12 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String sb = str;
        String sNum1 = sb.substring(0, 2);
        String sNum2 = sb.substring(2);
        int num1 = Integer.parseInt(sNum1);
        int num2 = Integer.parseInt(sNum2);

        //System.out.println(num1 + ":" + num2);

        if (0 < num1 && 0 < num2 && num1 <= 12 && num2 <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (0 < num1 && num1 <= 12) {
            System.out.println("MMYY");
        } else if (0 < num2 && num2 <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
        
    }
}