import java.util.*;

public class Main {
    //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    }

    public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    }
} import java.util.*; util.* java public class Main {
    //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    }

    public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    }
} Main //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc sln(s) sln s String[] args args public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    } sln {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    } int first = Integer.parseInt(s.substring(0, 2)); first Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int second = Integer.parseInt(s.substring(2)); second Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA"); (first > 0 && first < 13) && (second > 0 && second < 13) (first > 0 && first < 13) first > 0 first 0 first < 13 first 13 (second > 0 && second < 13) second > 0 second 0 second < 13 second 13 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA"); first > 0 && first < 13 first > 0 first 0 first < 13 first 13 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA"); second > 0 && second < 13 second > 0 second 0 second < 13 second 13 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" String s s public class Main {
    //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    }

    public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    }
} public class Main {
    //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    }

    public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    }
} Main
import java.util.*;

public class Main {
    //YYMM or MMYY
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sln(s);
    }

    public static void sln(String s) {
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
        if ((first > 0 && first < 13) && (second > 0 && second < 13)) System.out.println("AMBIGUOUS");
        else if (first > 0 && first < 13) System.out.println("MMYY");
        else if (second > 0 && second < 13) System.out.println("YYMM");
        else System.out.println("NA");
    }
}