import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
        import java.util.Collections;
        import java.util.List;
        import java.util.Scanner;

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.math.BigDecimal; BigDecimal java.math import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
} Main static private Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    } main {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    } String str1 = scan.next(); str1 scan.next() scan.next scan int ans_int = 0; ans_int 0 double ans_dob = 0; ans_dob 0 String ans = ""; ans "" StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(str1) sb.append sb str1 int int1 = Integer.parseInt(str1.substring(0,2)); int1 Integer.parseInt(str1.substring(0,2)) Integer.parseInt Integer str1.substring(0,2) str1.substring str1 0 2 int int2 = Integer.parseInt(str1.substring(2,4)); int2 Integer.parseInt(str1.substring(2,4)) Integer.parseInt Integer str1.substring(2,4) str1.substring str1 2 4 if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        } int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0 int2 > 0 int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0 int1 < 13 int1 13 int2 < 13 int2 13 int2 > 0 int2 0 int1 > 0 int1 0 {
            ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        } int1>0 && int1<13 int1>0 int1 0 int1<13 int1 13 {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        } int2 < 13 && int2 > 0 int2 < 13 int2 13 int2 > 0 int2 0 {
            ans = "YYMM";
        } ans = "YYMM" ans "YYMM" {
            ans = "NA";
        } ans = "NA" ans "NA" PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.println(ans) out.println out ans out.flush() out.flush out scan.close() scan.close scan String args[] args public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
} public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
} Main
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
        import java.util.Collections;
        import java.util.List;
        import java.util.Scanner;

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());

//        String str1 = scan.next();
//        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
        String str1 = scan.next();

        int ans_int = 0;
        double ans_dob = 0;
        String ans = "";


        StringBuilder sb = new StringBuilder();
        sb.append(str1);
        int int1 = Integer.parseInt(str1.substring(0,2));
        int int2 = Integer.parseInt(str1.substring(2,4));

        if(int1 < 13 && int2 < 13 && int2 > 0 && int1 > 0){
            ans = "AMBIGUOUS";
        }else if(int1>0 && int1<13){
            ans = "MMYY";
        }else if(int2 < 13 && int2 > 0){
            ans = "YYMM";
        }else {
            ans = "NA";
        }
            PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
}
