import java.util.Scanner;

public class Main {

    String s;

    public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    }

    boolean isYearCorrect(int year) {
        return false;
    }

    boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    }

    public static void main(String[] args) {
        new Main().solve();

    }
} import java.util.Scanner; Scanner java.util public class Main {

    String s;

    public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    }

    boolean isYearCorrect(int year) {
        return false;
    }

    boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    }

    public static void main(String[] args) {
        new Main().solve();

    }
} Main String s; s public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    } solve {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) s = sc.next() s sc.next() sc.next sc String x = s.substring(0, 2); x s.substring(0, 2) s.substring s 0 2 String y = s.substring(2, 4); y s.substring(2, 4) s.substring s 2 4 int mm1 = Integer.parseInt(x); mm1 Integer.parseInt(x) Integer.parseInt Integer x int mm2 = Integer.parseInt(y); mm2 Integer.parseInt(y) Integer.parseInt Integer y if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        } isMonthCorrect(mm1) && isMonthCorrect(mm2) isMonthCorrect(mm1) isMonthCorrect mm1 isMonthCorrect(mm2) isMonthCorrect mm2 {
            System.out.println("AMBIGUOUS");
            return;
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        } !isMonthCorrect(mm1) && isMonthCorrect(mm2) !isMonthCorrect(mm1) isMonthCorrect(mm1) isMonthCorrect mm1 isMonthCorrect(mm2) isMonthCorrect mm2 {
            System.out.println("YYMM");
            return;
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        } isMonthCorrect(mm1) && !isMonthCorrect(mm2) isMonthCorrect(mm1) isMonthCorrect mm1 !isMonthCorrect(mm2) isMonthCorrect(mm2) isMonthCorrect mm2 {
            System.out.println("MMYY");
            return;
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; System.out.println("NA") System.out.println System.out System System.out "NA" boolean isYearCorrect(int year) {
        return false;
    } isYearCorrect {
        return false;
    } return false; false int year year boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    } isMonthCorrect {
        return month >= 1 && month <= 12;
    } return month >= 1 && month <= 12; month >= 1 && month <= 12 month >= 1 month 1 month <= 12 month 12 int month month public static void main(String[] args) {
        new Main().solve();

    } main {
        new Main().solve();

    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    String s;

    public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    }

    boolean isYearCorrect(int year) {
        return false;
    }

    boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    }

    public static void main(String[] args) {
        new Main().solve();

    }
} public class Main {

    String s;

    public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    }

    boolean isYearCorrect(int year) {
        return false;
    }

    boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    }

    public static void main(String[] args) {
        new Main().solve();

    }
} Main
import java.util.Scanner;

public class Main {

    String s;

    public void solve() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();

        String x = s.substring(0, 2);
        String y = s.substring(2, 4);


        // case-1. month is correct in both cases
        int mm1 = Integer.parseInt(x);
        int mm2 = Integer.parseInt(y);

        if (isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (!isMonthCorrect(mm1) && isMonthCorrect(mm2)) {
            System.out.println("YYMM");
            return;
        }

        if (isMonthCorrect(mm1) && !isMonthCorrect(mm2)) {
            System.out.println("MMYY");
            return;
        }

        System.out.println("NA");


    }

    boolean isYearCorrect(int year) {
        return false;
    }

    boolean isMonthCorrect(int month) {
        return month >= 1 && month <= 12;
    }

    public static void main(String[] args) {
        new Main().solve();

    }
}
