import java.util.Scanner;

// B - YYMM or MMYY
// https://atcoder.jp/contests/abc126/tasks/abc126_b
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    }

    private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    }

    private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner scanner.close() scanner.close scanner boolean isYYMM = isYYMM(S); isYYMM isYYMM(S) isYYMM S boolean isMMYY = isMMYY(S); isMMYY isMMYY(S) isMMYY S if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM && isMMYY isYYMM isMMYY {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isMMYY {
            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 private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    } isYYMM {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    } int month = Integer.parseInt(s.substring(2, 4)); month Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 return month >= 1 && month <= 12; month >= 1 && month <= 12 month >= 1 month 1 month <= 12 month 12 String s s private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    } isMMYY {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    } int month = Integer.parseInt(s.substring(0, 2)); month Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 return month >= 1 && month <= 12; month >= 1 && month <= 12 month >= 1 month 1 month <= 12 month 12 String s s public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    }

    private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    }

    private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    }
} Main
import java.util.Scanner;

// B - YYMM or MMYY
// https://atcoder.jp/contests/abc126/tasks/abc126_b
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        boolean isYYMM = isYYMM(S);
        boolean isMMYY = isMMYY(S);
        if (isYYMM && isMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (isMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    private static boolean isYYMM(String s) {
        int month = Integer.parseInt(s.substring(2, 4));
        return month >= 1 && month <= 12;
    }

    private static boolean isMMYY(String s) {
        int month = Integer.parseInt(s.substring(0, 2));
        return month >= 1 && month <= 12;
    }
}
