import java.util.Scanner;

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

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

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

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

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

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

    } main {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String First = S.substring(0, 2); First S.substring(0, 2) S.substring S 0 2 String Second = S.substring(2, 4); Second S.substring(2, 4) S.substring S 2 4 int first = Integer.parseInt(First); first Integer.parseInt(First) Integer.parseInt Integer First int second = Integer.parseInt(Second); second Integer.parseInt(Second) Integer.parseInt Integer Second boolean yymm = false; yymm false boolean mmyy = false; mmyy false if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        } 0 <= first && first <= 99 && 1 <= second && second <= 12 1 <= second 0 <= first && first <= 99 && 1 <= second && second <= 12 0 <= first 0 first first <= 99 first 99 1 <= second 1 second second <= 12 second 12 {
            yymm = true;
        } yymm = true yymm true if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        } 0 <= second && second <= 99 && 1 <= first && first <= 12 1 <= first 0 <= second && second <= 99 && 1 <= first && first <= 12 0 <= second 0 second second <= 99 second 99 1 <= first 1 first first <= 12 first 12 {
            mmyy = true;
        } mmyy = true mmyy true if(yymm && !mmyy){
            System.out.println("YYMM");
        }else if(!yymm && mmyy){
            System.out.println("MMYY");
        }else if(!yymm && !mmyy){
            System.out.println("NA");
        }else{
            System.out.println("AMBIGUOUS");
        } yymm && !mmyy yymm !mmyy mmyy {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(!yymm && mmyy){
            System.out.println("MMYY");
        }else if(!yymm && !mmyy){
            System.out.println("NA");
        }else{
            System.out.println("AMBIGUOUS");
        } !yymm && mmyy !yymm yymm mmyy {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(!yymm && !mmyy){
            System.out.println("NA");
        }else{
            System.out.println("AMBIGUOUS");
        } !yymm && !mmyy !yymm yymm !mmyy mmyy {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

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

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

    }
} Main
import java.util.Scanner;

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

        String S = scanner.next();

        String First = S.substring(0, 2);
        String Second = S.substring(2, 4);

        int first = Integer.parseInt(First);
        int second = Integer.parseInt(Second);

        boolean yymm = false;
        boolean mmyy = false;

        if(0 <= first && first <= 99 && 1 <= second && second <= 12){
            yymm = true;
        }

        if(0 <= second && second <= 99 && 1 <= first && first <= 12){
            mmyy = true;
        }

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

    }
}
