import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    }

    private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    }
} import java.io.BufferedInputStream; BufferedInputStream java.io import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    }

    private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    }
} Main private static long n; n public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        } {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        } BufferedInputStream in = new BufferedInputStream(System.in) BufferedInputStream in = new BufferedInputStream(System.in) new BufferedInputStream(System.in) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(in); sc new Scanner(in) String s = sc.next(); s sc.next() sc.next sc boolean a = check(s.substring(0, 2)); a check(s.substring(0, 2)) check s.substring(0, 2) s.substring s 0 2 boolean b = check(s.substring(2)); b check(s.substring(2)) check s.substring(2) s.substring s 2 if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            } a && b a b {
                out.println("AMBIGUOUS");
            } out.println("AMBIGUOUS") out.println out "AMBIGUOUS" if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            } !a && !b !a a !b b {
                out.println("NA");
            } out.println("NA") out.println out "NA" if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            } a {
                out.println("MMYY");
            } out.println("MMYY") out.println out "MMYY" {
                out.println("YYMM");
            } out.println("YYMM") out.println out "YYMM" String[] args args private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    } check {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    } int x = Integer.parseInt(str); x Integer.parseInt(str) Integer.parseInt Integer str return x > 0 && x <= 12; x > 0 && x <= 12 x > 0 x 0 x <= 12 x 12 String str str public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    }

    private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    }
} public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    }

    private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    }
} Main
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:16-

            String s = sc.next();
            boolean a = check(s.substring(0, 2));
            boolean b = check(s.substring(2));

            if (a && b) {
                out.println("AMBIGUOUS");
            } else if (!a && !b) {
                out.println("NA");
            } else if (a) {
                out.println("MMYY");
            } else {
                out.println("YYMM");
            }
        }
    }

    private static boolean check(String str) {
        int x = Integer.parseInt(str);
        return x > 0 && x <= 12;
    }
}
