// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Objects; Objects java.util import java.util.Scanner; Scanner java.util import java.util.StringJoiner; StringJoiner java.util import java.util.stream.Stream; Stream java.util.stream public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    }
} Main public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    } main {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int firstHalf = Integer.parseInt(S.substring(0, 2)); firstHalf Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int endHalf = Integer.parseInt(S.substring(2, S.length())); endHalf Integer.parseInt(S.substring(2, S.length())) Integer.parseInt Integer S.substring(2, S.length()) S.substring S 2 S.length() S.length S String msg = ""; msg "" if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        } firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12 endHalf > 0 firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12 firstHalf > 0 firstHalf 0 firstHalf <= 12 firstHalf 12 endHalf > 0 endHalf 0 endHalf <= 12 endHalf 12 {
            msg = "AMBIGUOUS";
        } msg = "AMBIGUOUS" msg "AMBIGUOUS" if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        } firstHalf > 0 && firstHalf <= 12 firstHalf > 0 firstHalf 0 firstHalf <= 12 firstHalf 12 {
            msg = "MMYY";
        } msg = "MMYY" msg "MMYY" if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        } endHalf > 0 && endHalf <= 12 endHalf > 0 endHalf 0 endHalf <= 12 endHalf 12 {
            msg = "YYMM";
        } msg = "YYMM" msg "YYMM" {
            msg = "NA";
        } msg = "NA" msg "NA" System.out.println(msg) System.out.println System.out System System.out msg final String[] args args public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    }
} public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    }
} Main
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        // long u = sc.nextLong();

        int firstHalf = Integer.parseInt(S.substring(0, 2));
        int endHalf = Integer.parseInt(S.substring(2, S.length()));

        String msg = "";
        if (firstHalf > 0 && firstHalf <= 12 && endHalf > 0 && endHalf <= 12) {
            msg = "AMBIGUOUS";
        } else if (firstHalf > 0 && firstHalf <= 12) {
            msg = "MMYY";
        } else if (endHalf > 0 && endHalf <= 12) {
            msg = "YYMM";
        } else {
            msg = "NA";
        }

        System.out.println(msg);
    }
}