import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
    public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    }
    public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    }
    public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    }
    public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
    public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    }
    public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    }
    public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    }
    public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            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 sc.close() sc.close sc String S1 = S.substring(0, 2); S1 S.substring(0, 2) S.substring S 0 2 String S2 = S.substring(2, 4); S2 S.substring(2, 4) S.substring S 2 4 if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM(S1, S2) && isMMYY(S1, S2) isYYMM(S1, S2) isYYMM S1 S2 isMMYY(S1, S2) isMMYY S1 S2 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM(S1, S2) isYYMM S1 S2 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isMMYY(S1, S2) isMMYY S1 S2 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    } isYear {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    } int yy = Integer.valueOf(S); yy Integer.valueOf(S) Integer.valueOf Integer S if (0 <= yy && yy <= 99) {
            return true;
        } 0 <= yy && yy <= 99 0 <= yy 0 yy yy <= 99 yy 99 {
            return true;
        } return true; true return false; false String S S public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    } isMonth {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    } int mm = Integer.valueOf(S); mm Integer.valueOf(S) Integer.valueOf Integer S if (1 <= mm && mm <= 12) {
            return true;
        } 1 <= mm && mm <= 12 1 <= mm 1 mm mm <= 12 mm 12 {
            return true;
        } return true; true return false; false String S S public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    } isYYMM {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    } if (isYear(S) && isMonth(T)) {
            return true;
        } isYear(S) && isMonth(T) isYear(S) isYear S isMonth(T) isMonth T {
            return true;
        } return true; true return false; false String S S String T T public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    } isMMYY {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    } if (isMonth(S) && isYear(T)) {
            return true;
        } isMonth(S) && isYear(T) isMonth(S) isMonth S isYear(T) isYear T {
            return true;
        } return true; true return false; false String S S String T T public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
    public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    }
    public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    }
    public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    }
    public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
    public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    }
    public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    }
    public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    }
    public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String S1 = S.substring(0, 2);
        String S2 = S.substring(2, 4);
        if (isYYMM(S1, S2) && isMMYY(S1, S2)) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM(S1, S2)) {
            System.out.println("YYMM");
        } else if (isMMYY(S1, S2)) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
    public static boolean isYear(String S) {
        int yy = Integer.valueOf(S);
        if (0 <= yy && yy <= 99) {
            return true;
        }
        return false;
    }
    public static boolean isMonth(String S) {
        int mm = Integer.valueOf(S);
        if (1 <= mm && mm <= 12) {
            return true;
        }
        return false;
    }
    public static boolean isYYMM(String S, String T) {
        if (isYear(S) && isMonth(T)) {
            return true;
        }
        return false;
    }
    public static boolean isMMYY(String S, String T) {
        if (isMonth(S) && isYear(T)) {
            return true;
        }
        return false;
    }
}
