import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz