import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
}

/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