import java.util.Scanner;

public class Main {
    
    private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    }    

    private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    }    
    
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    }
} import java.util.Scanner; Scanner java.util public class Main {
    
    private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    }    

    private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    }    
    
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    }
} Main private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    } isValidMonth {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    } if (elem >= 1 && elem <= 12) {
            return true;        
        } elem >= 1 && elem <= 12 elem >= 1 elem 1 elem <= 12 elem 12 {
            return true;        
        } return true; true return false; false int elem elem private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    } isValidYear {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    } if (elem >= 0) {
            return true;        
        } elem >= 0 elem 0 {
            return true;        
        } return true; true return false; false int elem elem public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    } try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        } {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int first = Integer.parseInt(s.substring(0,2)); first Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int second = Integer.parseInt(s.substring(2)); second Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            } (isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first)) (isValidMonth(first) && isValidYear(second)) isValidMonth(first) isValidMonth first isValidYear(second) isValidYear second (isValidMonth(second) && isValidYear(first)) isValidMonth(second) isValidMonth second isValidYear(first) isValidYear first {
                System.out.println("AMBIGUOUS");            
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            } (isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first)) (isValidMonth(first) && isValidYear(second)) isValidMonth(first) isValidMonth first isValidYear(second) isValidYear second !(isValidMonth(second) && isValidYear(first)) (isValidMonth(second) && isValidYear(first)) isValidMonth(second) isValidMonth second isValidYear(first) isValidYear first {
                System.out.println("MMYY");            
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            } !(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first)) !(isValidMonth(first) && isValidYear(second)) (isValidMonth(first) && isValidYear(second)) isValidMonth(first) isValidMonth first isValidYear(second) isValidYear second (isValidMonth(second) && isValidYear(first)) isValidMonth(second) isValidMonth second isValidYear(first) isValidYear first {
                System.out.println("YYMM");            
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
                System.out.println("NA");    
            } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {
    
    private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    }    

    private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    }    
    
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    }
} public class Main {
    
    private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    }    

    private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    }    
    
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    }
} Main
import java.util.Scanner;

public class Main {
    
    private static boolean isValidMonth (int elem) {
        if (elem >= 1 && elem <= 12) {
            return true;        
        }        
        return false;
    }    

    private static boolean isValidYear (int elem) {
        if (elem >= 0) {
            return true;        
        }        
        return false;
    }    
    
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int first = Integer.parseInt(s.substring(0,2));
            int second = Integer.parseInt(s.substring(2));
            if ((isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("AMBIGUOUS");            
            }
            else if ((isValidMonth(first) && isValidYear(second)) && !(isValidMonth(second) && isValidYear(first))) {
                System.out.println("MMYY");            
            }
            else if (!(isValidMonth(first) && isValidYear(second)) && (isValidMonth(second) && isValidYear(first))) {
                System.out.println("YYMM");            
            }
            else {
                System.out.println("NA");    
            }
        }    
    }
}