import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



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

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    } main {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String first = S.substring(0,2); first S.substring(0,2) S.substring S 0 2 String end = S.substring(2,4); end S.substring(2,4) S.substring S 2 4 int YY = Integer.parseInt(first); YY Integer.parseInt(first) Integer.parseInt Integer first int MM = Integer.parseInt(end); MM Integer.parseInt(end) Integer.parseInt Integer end if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        } YY >= 1 && YY <=12 YY >= 1 YY 1 YY <=12 YY 12 {
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        } if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            } MM >= 1 && MM <= 12 MM >= 1 MM 1 MM <= 12 MM 12 {
                System.out.print("AMBIGUOUS");
            } System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" {
                System.out.print("MMYY");
            } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" {
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        } if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            } MM >= 1 && MM <= 12 MM >= 1 MM 1 MM <= 12 MM 12 {
                System.out.print("YYMM");
            } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" {
                System.out.print("NA");
            } System.out.print("NA") System.out.print 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 S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        String first = S.substring(0,2);
        String end = S.substring(2,4);

        int YY = Integer.parseInt(first);
        int MM = Integer.parseInt(end);
        
        if (YY >= 1 && YY <=12){
            if(MM >= 1 && MM <= 12){
                System.out.print("AMBIGUOUS");
            }else{
                System.out.print("MMYY");
            }
        }else{
            if(MM >= 1 && MM <= 12){
                System.out.print("YYMM");
            }else{
                System.out.print("NA");
            }
        }



    }
}