import java.util.Scanner;

public class Main {

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    }
}
/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