import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String[] SH = S.split(""); SH S.split("") S.split S "" String Kotae; Kotae String SHaM = SH[0]+SH[1]; SHaM SH[0]+SH[1] SH[0] SH 0 SH[1] SH 1 String SHbM = SH[2]+SH[3]; SHbM SH[2]+SH[3] SH[2] SH 2 SH[3] SH 3 int SHa= Integer.parseInt(SHaM); SHa Integer.parseInt(SHaM) Integer.parseInt Integer SHaM int SHb= Integer.parseInt(SHbM); SHb Integer.parseInt(SHbM) Integer.parseInt Integer SHbM if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        } SHa==00 || SHa>=13 SHa==00 SHa 00 SHa>=13 SHa 13 {
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        } if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            } SHb==00 || SHb>=13 SHb==00 SHb 00 SHb>=13 SHb 13 {
                Kotae = "NA";
            } Kotae = "NA" Kotae "NA" {
                Kotae = "YYMM";
            } Kotae = "YYMM" Kotae "YYMM" {
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        } if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            } SHb==00 || SHb>=13 SHb==00 SHb 00 SHb>=13 SHb 13 {
                Kotae = "MMYY";
            } Kotae = "MMYY" Kotae "MMYY" {
                Kotae = "AMBIGUOUS";
            } Kotae = "AMBIGUOUS" Kotae "AMBIGUOUS" System.out.println(Kotae) System.out.println System.out System System.out Kotae String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
}