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
 *
 * @author Abhijeetkns
 */
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);
        BYYMMOrMMYY solver = new BYYMMOrMMYY();
        solver.solve(1, in, out);
        out.close();
    }

    static class BYYMMOrMMYY {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 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);
        BYYMMOrMMYY solver = new BYYMMOrMMYY();
        solver.solve(1, in, out);
        out.close();
    }

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

    } BYYMMOrMMYY public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA");
        } solve {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA");
        } String s = in.next(); s in.next() in.next in int val1 = Integer.parseInt(s.substring(0, 2)); val1 Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int val2 = Integer.parseInt(s.substring(2, 4)); val2 Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA"); (val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12) (val1 >= 1 && val1 <= 12) val1 >= 1 val1 1 val1 <= 12 val1 12 (val2 >= 1 && val2 <= 12) val2 >= 1 val2 1 val2 <= 12 val2 12 out.println("AMBIGUOUS") out.println out "AMBIGUOUS" if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA"); (val1 >= 1 && val1 <= 12) val1 >= 1 val1 1 val1 <= 12 val1 12 out.println("MMYY") out.println out "MMYY" if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA"); val2 >= 1 && val2 <= 12 val2 >= 1 val2 1 val2 <= 12 val2 12 out.println("YYMM") out.println out "YYMM" 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);
        BYYMMOrMMYY solver = new BYYMMOrMMYY();
        solver.solve(1, in, out);
        out.close();
    }

    static class BYYMMOrMMYY {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 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);
        BYYMMOrMMYY solver = new BYYMMOrMMYY();
        solver.solve(1, in, out);
        out.close();
    }

    static class BYYMMOrMMYY {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 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
 *
 * @author Abhijeetkns
 */
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);
        BYYMMOrMMYY solver = new BYYMMOrMMYY();
        solver.solve(1, in, out);
        out.close();
    }

    static class BYYMMOrMMYY {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int val1 = Integer.parseInt(s.substring(0, 2));
            int val2 = Integer.parseInt(s.substring(2, 4));
            if ((val1 >= 1 && val1 <= 12) && (val2 >= 1 && val2 <= 12)) out.println("AMBIGUOUS");
            else if ((val1 >= 1 && val1 <= 12)) out.println("MMYY");
            else if (val2 >= 1 && val2 <= 12) out.println("YYMM");
            else out.println("NA");
        }

    }
}

