import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in int fore = Integer.valueOf(s.substring(0, 2)); fore Integer.valueOf(s.substring(0, 2)) Integer.valueOf Integer s.substring(0, 2) s.substring s 0 2 int latt = Integer.valueOf(s.substring(2, 4)); latt Integer.valueOf(s.substring(2, 4)) Integer.valueOf Integer s.substring(2, 4) s.substring s 2 4 boolean isyymm = false; isyymm false boolean ismmyy = false; ismmyy false if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        } fore >= 1 && fore <= 12 fore >= 1 fore 1 fore <= 12 fore 12 {
            ismmyy = true;
        } ismmyy = true ismmyy true if (latt >= 1 && latt <= 12) {
            isyymm = true;
        } latt >= 1 && latt <= 12 latt >= 1 latt 1 latt <= 12 latt 12 {
            isyymm = true;
        } isyymm = true isyymm true if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } ismmyy && isyymm ismmyy isyymm {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } ismmyy {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } isyymm {
            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 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
}
