import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ABC126_b solver = new ABC126_b(); solver new ABC126_b() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    } ABC126_b public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        } solve {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        } String S = in.next(); S in.next() in.next in boolean gate[] = new boolean[2]; gate new boolean[2] 2 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, 4)); second Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if ((first > 0) && (first < 13)) {
                gate[0] = true;
            } (first > 0) && (first < 13) (first > 0) first 0 (first < 13) first 13 {
                gate[0] = true;
            } gate[0] = true gate[0] gate 0 true if ((second > 0) && (second < 13)) {
                gate[1] = true;
            } (second > 0) && (second < 13) (second > 0) second 0 (second < 13) second 13 {
                gate[1] = true;
            } gate[1] = true gate[1] gate 1 true if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            } (gate[0]) && (gate[1]) (gate[0]) gate 0 (gate[1]) gate 1 {
                out.println("AMBIGUOUS");
                return;
            } out.println("AMBIGUOUS") out.println out "AMBIGUOUS" return; if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            } (!gate[0]) && (gate[1]) (!gate[0]) gate[0] gate 0 (gate[1]) gate 1 {
                out.println("YYMM");
                return;
            } out.println("YYMM") out.println out "YYMM" return; if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            } (gate[0]) && (!gate[1]) (gate[0]) gate 0 (!gate[1]) gate[1] gate 1 {
                out.println("MMYY");
                return;
            } out.println("MMYY") out.println out "MMYY" return; out.println("NA") out.println out "NA" int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC126_b solver = new ABC126_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC126_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            boolean gate[] = new boolean[2];

            int first = Integer.parseInt(S.substring(0, 2));
            int second = Integer.parseInt(S.substring(2, 4));

            if ((first > 0) && (first < 13)) {
                gate[0] = true;
            }
            if ((second > 0) && (second < 13)) {
                gate[1] = true;
            }
            if ((gate[0]) && (gate[1])) {
                out.println("AMBIGUOUS");
                return;
            }
            if ((!gate[0]) && (gate[1])) {
                out.println("YYMM");
                return;
            }
            if ((gate[0]) && (!gate[1])) {
                out.println("MMYY");
                return;
            }
            out.println("NA");
        }

    }
}

