import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    } main {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) String mymy = s.next(); mymy s.next() s.next s String first = mymy.substring(0, 2); first mymy.substring(0, 2) mymy.substring mymy 0 2 String second = mymy.substring(2, 4); second mymy.substring(2, 4) mymy.substring mymy 2 4 int fi = Integer.parseInt(first); fi Integer.parseInt(first) Integer.parseInt Integer first int se = Integer.parseInt(second); se Integer.parseInt(second) Integer.parseInt Integer second String alg; alg if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        } 0 < fi && fi <= 12 0 < fi 0 fi fi <= 12 fi 12 {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY"; 0 < se && se <= 12 0 < se 0 se se <= 12 se 12 alg = "AMBIGUOUS" alg "AMBIGUOUS" alg = "MMYY" alg "MMYY" {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        } if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA"; 0 < se && se <= 12 0 < se 0 se se <= 12 se 12 alg = "YYMM" alg "YYMM" alg = "NA" alg "NA" System.out.println(alg) System.out.println System.out System System.out alg String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String mymy = s.next();
        String first = mymy.substring(0, 2);
        String second = mymy.substring(2, 4);
        int fi = Integer.parseInt(first);
        int se = Integer.parseInt(second);
        String alg;
        if (0 < fi && fi <= 12) {
            if (0 < se && se <= 12) alg = "AMBIGUOUS";
            else alg = "MMYY";
        } else {
            if (0 < se && se <= 12) alg = "YYMM";
            else alg = "NA";
        }
        System.out.println(alg);
    }
}