import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    } main {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String fa = s.substring(0, 2); fa s.substring(0, 2) s.substring s 0 2 String ea = s.substring(2); ea s.substring(2) s.substring s 2 int f = Integer.parseInt(fa); f Integer.parseInt(fa) Integer.parseInt Integer fa int e = Integer.parseInt(ea); e Integer.parseInt(ea) Integer.parseInt Integer ea if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        } e == 0 e 0 {
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        } if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            } f == 0 || f > 12 f == 0 f 0 f > 12 f 12 {
                System.out.println("NA");
                return;
            } System.out.println("NA") System.out.println System.out System System.out "NA" return; System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        } f == 0 f 0 {
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        } if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            } e == 0 || e > 12 e == 0 e 0 e > 12 e 12 {
                System.out.println("NA");
                return;
            } System.out.println("NA") System.out.println System.out System System.out "NA" return; System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        } e <= 12 e 12 {
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        } if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            } f <= 12 f 12 {
                System.out.println("AMBIGUOUS");
                return;
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; {
                System.out.println("YYMM");
                return;
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; {
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        } if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            } f <= 12 f 12 {
                System.out.println("MMYY");
                return;
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; {
                System.out.println("NA");
                return;
            } System.out.println("NA") System.out.println System.out System System.out "NA" return; String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String fa = s.substring(0, 2);
        String ea = s.substring(2);
        int f = Integer.parseInt(fa);
        int e = Integer.parseInt(ea);
        if(e == 0){
            if(f == 0 || f > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("MMYY");
            return;
        }
        if(f == 0){
            if(e == 0 || e > 12){
                System.out.println("NA");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(e <= 12){
            if(f <= 12){
                System.out.println("AMBIGUOUS");
                return;
            }else{
                System.out.println("YYMM");
                return;
            }
        }else{
            if(f <= 12){
                System.out.println("MMYY");
                return;
            }else{
                System.out.println("NA");
                return;
            }
        }
    }
}
