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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    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);
        B solver = new 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);
        B solver = new 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) B solver = new B(); solver new B() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            }
            // 出力

        }

    } B public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            }
            // 出力

        } solve {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            }
            // 出力

        } String S = in.next(); S in.next() in.next in int s_a = Integer.parseInt(S.substring(0, 2)); s_a Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int s_b = Integer.parseInt(S.substring(2, 4)); s_b Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            } s_a >= 1 && s_a <= 12 s_a >= 1 s_a 1 s_a <= 12 s_a 12 {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                } s_b >= 1 && s_b <= 12 s_b >= 1 s_b 1 s_b <= 12 s_b 12 {
                    out.println("AMBIGUOUS");
                } out.println("AMBIGUOUS") out.println out "AMBIGUOUS" {
                    out.println("MMYY");
                } out.println("MMYY") out.println out "MMYY" {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            } if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                } s_b >= 1 && s_b <= 12 s_b >= 1 s_b 1 s_b <= 12 s_b 12 {
                    out.println("YYMM");
                } out.println("YYMM") out.println out "YYMM" {
                    out.println("NA");
                } 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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int s_a = Integer.parseInt(S.substring(0, 2));
            int s_b = Integer.parseInt(S.substring(2, 4));
            if (s_a >= 1 && s_a <= 12) {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("AMBIGUOUS");
                } else {
                    out.println("MMYY");
                }
            } else {
                if (s_b >= 1 && s_b <= 12) {
                    out.println("YYMM");
                } else {
                    out.println("NA");
                }
            }
            // 出力

        }

    }
}

