import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
} 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 f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String f = S.substring(0, 2); f S.substring(0, 2) S.substring S 0 2 String b = S.substring(2); b S.substring(2) S.substring S 2 int fm = Integer.parseInt(f); fm Integer.parseInt(f) Integer.parseInt Integer f int bm = Integer.parseInt(b); bm Integer.parseInt(b) Integer.parseInt Integer b if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        } fm>12 && bm>12 fm>12 fm 12 bm>12 bm 12 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        } (fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0) (fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0) (fm>12 && bm==0) fm>12 fm 12 bm==0 bm 0 (fm==0 && bm>12) fm==0 fm 0 bm>12 bm 12 (fm==0 & bm==0) fm==0 fm 0 bm==0 bm 0 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        } fm<=12 && fm>0 && bm<=12 && bm>0 bm<=12 fm<=12 && fm>0 && bm<=12 && bm>0 fm<=12 fm 12 fm>0 fm 0 bm<=12 bm 12 bm>0 bm 0 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        } (fm>12 || fm==0) && bm<=12 && bm>0 (fm>12 || fm==0) && bm<=12 && bm>0 (fm>12 || fm==0) fm>12 fm 12 fm==0 fm 0 bm<=12 bm 12 bm>0 bm 0 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        } (bm>12 || bm==0) && fm<=12 && fm>0 (bm>12 || bm==0) && fm<=12 && fm>0 (bm>12 || bm==0) bm>12 bm 12 bm==0 bm 0 fm<=12 fm 12 fm>0 fm 0 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
}