import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    }
}

class Solver {
    public String solve(long S) {
        long first = S / 100;
        long second = S % 100;

        if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        }

        if (first >= 1 && first <= 12) {
            return "MMYY";
        }

        if (second >= 1 && second <= 12) {
            return "YYMM";
        }

        return "NA";
    }
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    }
} Main public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    } main {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long S; S S = sc.nextLong() S sc.nextLong() sc.nextLong sc final Solver solver = new Solver(); solver new Solver() System.out.println(solver.solve(S)) System.out.println System.out System System.out solver.solve(S) solver.solve solver S final String[] args args class Solver {
    public String solve(long S) {
        long first = S / 100;
        long second = S % 100;

        if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        }

        if (first >= 1 && first <= 12) {
            return "MMYY";
        }

        if (second >= 1 && second <= 12) {
            return "YYMM";
        }

        return "NA";
    }
} Solver public String solve(long S) {
        long first = S / 100;
        long second = S % 100;

        if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        }

        if (first >= 1 && first <= 12) {
            return "MMYY";
        }

        if (second >= 1 && second <= 12) {
            return "YYMM";
        }

        return "NA";
    } solve {
        long first = S / 100;
        long second = S % 100;

        if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        }

        if (first >= 1 && first <= 12) {
            return "MMYY";
        }

        if (second >= 1 && second <= 12) {
            return "YYMM";
        }

        return "NA";
    } long first = S / 100; first S / 100 S 100 long second = S % 100; second S % 100 S 100 if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        } (first >= 1 && first <= 12) && (second >= 1 && second <= 12) (first >= 1 && first <= 12) first >= 1 first 1 first <= 12 first 12 (second >= 1 && second <= 12) second >= 1 second 1 second <= 12 second 12 {
            return "AMBIGUOUS";
        } return "AMBIGUOUS"; "AMBIGUOUS" if (first >= 1 && first <= 12) {
            return "MMYY";
        } first >= 1 && first <= 12 first >= 1 first 1 first <= 12 first 12 {
            return "MMYY";
        } return "MMYY"; "MMYY" if (second >= 1 && second <= 12) {
            return "YYMM";
        } second >= 1 && second <= 12 second >= 1 second 1 second <= 12 second 12 {
            return "YYMM";
        } return "YYMM"; "YYMM" return "NA"; "NA" long S S public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    }
} public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    }
} Main
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long S;
        S = sc.nextLong();

        final Solver solver = new Solver();
        System.out.println(solver.solve(S));
    }
}

class Solver {
    public String solve(long S) {
        long first = S / 100;
        long second = S % 100;

        if ((first >= 1 && first <= 12) && (second >= 1 && second <= 12)) {
            return "AMBIGUOUS";
        }

        if (first >= 1 && first <= 12) {
            return "MMYY";
        }

        if (second >= 1 && second <= 12) {
            return "YYMM";
        }

        return "NA";
    }
}

