
import java.util.Scanner;

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

        int first = Integer.parseInt(str.substring(0, 2));
        int second = Integer.parseInt(str.substring(2, 4));
        //System.out.println(first +" " + second);
        if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA");

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

        int first = Integer.parseInt(str.substring(0, 2));
        int second = Integer.parseInt(str.substring(2, 4));
        //System.out.println(first +" " + second);
        if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA");

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

        int first = Integer.parseInt(str.substring(0, 2));
        int second = Integer.parseInt(str.substring(2, 4));
        //System.out.println(first +" " + second);
        if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA");

    } main {
        Scanner in = new Scanner(System.in);
        String str = in.next();

        int first = Integer.parseInt(str.substring(0, 2));
        int second = Integer.parseInt(str.substring(2, 4));
        //System.out.println(first +" " + second);
        if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA");

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String str = in.next(); str in.next() in.next in int first = Integer.parseInt(str.substring(0, 2)); first Integer.parseInt(str.substring(0, 2)) Integer.parseInt Integer str.substring(0, 2) str.substring str 0 2 int second = Integer.parseInt(str.substring(2, 4)); second Integer.parseInt(str.substring(2, 4)) Integer.parseInt Integer str.substring(2, 4) str.substring str 2 4 if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA"); (first <=12 && first >0) && (second<=12 && second>0) (first <=12 && first >0) first <=12 first 12 first >0 first 0 (second<=12 && second>0) second<=12 second 12 second>0 second 0 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA"); first <=12 && first >0 first <=12 first 12 first >0 first 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA"); second<=12 && second>0 second<=12 second 12 second>0 second 0 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args

import java.util.Scanner;

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

        int first = Integer.parseInt(str.substring(0, 2));
        int second = Integer.parseInt(str.substring(2, 4));
        //System.out.println(first +" " + second);
        if((first <=12 && first >0) && (second<=12 && second>0))
            System.out.println("AMBIGUOUS");
        else
            if(first <=12 && first >0)
                System.out.println("MMYY");
            else
                if(second<=12 && second>0)
                    System.out.println("YYMM");
                else
                    System.out.println("NA");

    }
}
