import java.util.Scanner;

public class Main {

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    } main {
        final Scanner sc = new Scanner(System.in);

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String S = sc.next(); S sc.next() sc.next sc final int upper = Integer.valueOf(S.substring(0, 2)); upper Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 final int lower = Integer.valueOf(S.substring(2, 4)); lower Integer.valueOf(S.substring(2, 4)) Integer.valueOf Integer S.substring(2, 4) S.substring S 2 4 if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= upper && upper <= 12 && 1 <= lower && lower <= 12 1 <= lower 1 <= upper && upper <= 12 && 1 <= lower && lower <= 12 1 <= upper 1 upper upper <= 12 upper 12 1 <= lower 1 lower lower <= 12 lower 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= upper && upper <= 12 1 <= upper 1 upper upper <= 12 upper 12 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= lower && lower <= 12 1 <= lower 1 lower lower <= 12 lower 12 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} public class Main {

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} Main
import java.util.Scanner;

public class Main {

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

        final String S = sc.next();

        final int upper = Integer.valueOf(S.substring(0, 2));
        final int lower = Integer.valueOf(S.substring(2, 4));

        if (1 <= upper && upper <= 12 && 1 <= lower && lower <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= upper && upper <= 12) {
            System.out.println("MMYY");
        } else if (1 <= lower && lower <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
}
