import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int s1 = Integer.parseInt(s.substring(0,2));
        int s2 = Integer.parseInt(s.substring(2,4));
        int jnum = 4;//1,yymm 2,mmyy 3,ambiguous 4,na

        if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        }

        if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        }
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int s1 = Integer.parseInt(s.substring(0,2));
        int s2 = Integer.parseInt(s.substring(2,4));
        int jnum = 4;//1,yymm 2,mmyy 3,ambiguous 4,na

        if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        }

        if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int s1 = Integer.parseInt(s.substring(0,2));
        int s2 = Integer.parseInt(s.substring(2,4));
        int jnum = 4;//1,yymm 2,mmyy 3,ambiguous 4,na

        if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        }

        if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int s1 = Integer.parseInt(s.substring(0,2));
        int s2 = Integer.parseInt(s.substring(2,4));
        int jnum = 4;//1,yymm 2,mmyy 3,ambiguous 4,na

        if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        }

        if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int s1 = Integer.parseInt(s.substring(0,2)); s1 Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int s2 = Integer.parseInt(s.substring(2,4)); s2 Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 int jnum = 4; jnum 4 if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        } (s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12)) (s1 > 12 && (1<=s2 && s2<=12)) s1 > 12 s1 12 (1<=s2 && s2<=12) 1<=s2 1 s2 s2<=12 s2 12 (s1 == 0 && (1<=s2 && s2<=12)) s1 == 0 s1 0 (1<=s2 && s2<=12) 1<=s2 1 s2 s2<=12 s2 12 {
            jnum = 1;
        } jnum = 1 jnum 1 if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        } ((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0) ((1<=s1 && s1<=12) && s2 > 12) (1<=s1 && s1<=12) 1<=s1 1 s1 s1<=12 s1 12 s2 > 12 s2 12 ((1<=s1 && s1<=12) && s2 == 0) (1<=s1 && s1<=12) 1<=s1 1 s1 s1<=12 s1 12 s2 == 0 s2 0 {
            jnum = 2;
        } jnum = 2 jnum 2 if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        } (1<=s1 && s1<=12) && (1<=s2 && s2<=12) (1<=s1 && s1<=12) 1<=s1 1 s1 s1<=12 s1 12 (1<=s2 && s2<=12) 1<=s2 1 s2 s2<=12 s2 12 {
            jnum = 3;
        } jnum = 3 jnum 3 if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        } (s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0) (s1 > 12 && s2> 12) s1 > 12 s1 12 s2> 12 s2 12 (s1 == 0 && s2 == 0) s1 == 0 s1 0 s2 == 0 s2 0 {
            jnum = 4;
        } jnum = 4 jnum 4 if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        } jnum == 1 jnum 1 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        } jnum == 2 jnum 2 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        } jnum == 3 jnum 3 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(jnum == 4){
            System.out.println("NA");
        } jnum == 4 jnum 4 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int s1 = Integer.parseInt(s.substring(0,2));
        int s2 = Integer.parseInt(s.substring(2,4));
        int jnum = 4;//1,yymm 2,mmyy 3,ambiguous 4,na

        if((s1 > 12 && (1<=s2 && s2<=12)) || (s1 == 0 && (1<=s2 && s2<=12))){
            jnum = 1;
        }else if(((1<=s1 && s1<=12) && s2 > 12) || ((1<=s1 && s1<=12) && s2 == 0)){
            jnum = 2;
        }else if((1<=s1 && s1<=12) && (1<=s2 && s2<=12)){
            jnum = 3;
        }else if((s1 > 12 && s2> 12)||(s1 == 0 && s2 == 0)){
            jnum = 4;
        }

        if(jnum == 1){
            System.out.println("YYMM");
        }else if(jnum == 2){
            System.out.println("MMYY");
        }else if(jnum == 3){
            System.out.println("AMBIGUOUS");
        }else if(jnum == 4){
            System.out.println("NA");
        }
    }
}
