import java.util.*;

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

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	} main {
		Scanner sc = new Scanner(System.in);

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String date = sc.next(); date sc.next() sc.next sc int date1 = Integer.parseInt(date.substring(0, 2)); date1 Integer.parseInt(date.substring(0, 2)) Integer.parseInt Integer date.substring(0, 2) date.substring date 0 2 int date2 = Integer.parseInt(date.substring(2, 4)); date2 Integer.parseInt(date.substring(2, 4)) Integer.parseInt Integer date.substring(2, 4) date.substring date 2 4 int yymm = 0; yymm 0 int mmyy = 0; mmyy 0 if (date2 != 0 && date2 < 13) {
            yymm = 1;
        } date2 != 0 && date2 < 13 date2 != 0 date2 0 date2 < 13 date2 13 {
            yymm = 1;
        } yymm = 1 yymm 1 if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        } date1 != 0 && date1 < 13 date1 != 0 date1 0 date1 < 13 date1 13 {
            mmyy = 1;
        } mmyy = 1 mmyy 1 if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        } yymm == 1 && mmyy == 1 yymm == 1 yymm 1 mmyy == 1 mmyy 1 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        } yymm == 0 && mmyy == 0 yymm == 0 yymm 0 mmyy == 0 mmyy 0 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        } yymm == 1 yymm 1 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	}
} Main
import java.util.*;

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

        String date = sc.next();
        int date1 = Integer.parseInt(date.substring(0, 2));
        int date2 = Integer.parseInt(date.substring(2, 4));

        int yymm = 0;
        int mmyy = 0;

        if (date2 != 0 && date2 < 13) {
            yymm = 1;
        }
        if (date1 != 0 && date1 < 13) {
            mmyy = 1;
        }

        if (yymm == 1 && mmyy == 1) {
            System.out.println("AMBIGUOUS");
        } else if (yymm == 0 && mmyy == 0) {
            System.out.println("NA");
        } else if (yymm == 1) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
	}
}