import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    } main {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String str=sc.next(); str sc.next() sc.next sc sc.close() sc.close sc int a=Integer.parseInt(str.substring(0,2)); a Integer.parseInt(str.substring(0,2)) Integer.parseInt Integer str.substring(0,2) str.substring str 0 2 int b=Integer.parseInt(str.substring(2)); b Integer.parseInt(str.substring(2)) Integer.parseInt Integer str.substring(2) str.substring str 2 boolean am=false am false bm=false; bm false if(1<=a&&a<=12)am=true; 1<=a&&a<=12 1<=a 1 a a<=12 a 12 am=true am true if(1<=b&&b<=12)bm=true; 1<=b&&b<=12 1<=b 1 b b<=12 b 12 bm=true bm true if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        } am&&bm am bm {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        } am==false&&bm==false am==false am false bm==false bm false {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        } am==false am false {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            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) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        int a=Integer.parseInt(str.substring(0,2));
        int b=Integer.parseInt(str.substring(2));
        boolean am=false,bm=false;
        if(1<=a&&a<=12)am=true;
        if(1<=b&&b<=12)bm=true;
        if(am&&bm){
            System.out.println("AMBIGUOUS");
        }else if(am==false&&bm==false){
            System.out.println("NA");
        }else if(am==false){
            System.out.println("YYMM");
        }else{
            System.out.println("MMYY");
        }
    }
}
