import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String[] C = S.split("");
        String I1 = C[0] + C[1];
        String I2 = C[2] + C[3];
        int N1 = Integer.parseInt(I1);
        int N2 = Integer.parseInt(I2);
        String ans;
        if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";}
        System.out.print(ans);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String[] C = S.split("");
        String I1 = C[0] + C[1];
        String I2 = C[2] + C[3];
        int N1 = Integer.parseInt(I1);
        int N2 = Integer.parseInt(I2);
        String ans;
        if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";}
        System.out.print(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String[] C = S.split("");
        String I1 = C[0] + C[1];
        String I2 = C[2] + C[3];
        int N1 = Integer.parseInt(I1);
        int N2 = Integer.parseInt(I2);
        String ans;
        if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";}
        System.out.print(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String[] C = S.split("");
        String I1 = C[0] + C[1];
        String I2 = C[2] + C[3];
        int N1 = Integer.parseInt(I1);
        int N2 = Integer.parseInt(I2);
        String ans;
        if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";}
        System.out.print(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc String[] C = S.split(""); C S.split("") S.split S "" String I1 = C[0] + C[1]; I1 C[0] + C[1] C[0] C 0 C[1] C 1 String I2 = C[2] + C[3]; I2 C[2] + C[3] C[2] C 2 C[3] C 3 int N1 = Integer.parseInt(I1); N1 Integer.parseInt(I1) Integer.parseInt Integer I1 int N2 = Integer.parseInt(I2); N2 Integer.parseInt(I2) Integer.parseInt Integer I2 String ans; ans if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";} N1 != 00 && N2 != 00 N1 != 00 N1 00 N2 != 00 N2 00 {
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        } if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            } N1 <= 12 N1 12 {
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            } ans = (N2<=12)? "AMBIGUOUS" : "MMYY" ans (N2<=12)? "AMBIGUOUS" : "MMYY" (N2<=12) N2 12 "AMBIGUOUS" "MMYY" {
                ans = (N2<=12)? "YYMM":"NA";
            } ans = (N2<=12)? "YYMM":"NA" ans (N2<=12)? "YYMM":"NA" (N2<=12) N2 12 "YYMM" "NA" if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";} N1==00 N1 00 {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        } ans = (N2<=12 && N2 > 0)? "YYMM":"NA" ans (N2<=12 && N2 > 0)? "YYMM":"NA" (N2<=12 && N2 > 0) N2<=12 N2 12 N2 > 0 N2 0 "YYMM" "NA" if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";} N2==00 N2 00 {
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        } ans = (N1<=12 && N1 > 0)? "MMYY":"NA" ans (N1<=12 && N1 > 0)? "MMYY":"NA" (N1<=12 && N1 > 0) N1<=12 N1 12 N1 > 0 N1 0 "MMYY" "NA" {ans = "NA";} ans = "NA" ans "NA" System.out.print(ans) System.out.print System.out System System.out ans String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String[] C = S.split("");
        String I1 = C[0] + C[1];
        String I2 = C[2] + C[3];
        int N1 = Integer.parseInt(I1);
        int N2 = Integer.parseInt(I2);
        String ans;
        if(N1 != 00 && N2 != 00){
            if(N1 <= 12){
                ans = (N2<=12)? "AMBIGUOUS" : "MMYY";
            }
            else{
                ans = (N2<=12)? "YYMM":"NA";
            }
        }
        else if(N1==00) {
            ans = (N2<=12 && N2 > 0)? "YYMM":"NA";
        }
        else if(N2==00){
            ans = (N1<=12 && N1 > 0)? "MMYY":"NA";
        }
        else {ans = "NA";}
        System.out.print(ans);
    }
}