import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    } main {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int mae = Integer.parseInt(s.substring(0, 2)); mae Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int ushiro = Integer.parseInt(s.substring(2, 4)); ushiro Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 boolean maeIsMM = false; maeIsMM false boolean ushiroIsMM = false; ushiroIsMM false if (mae > 0 && mae < 13) {
            maeIsMM = true;
        } mae > 0 && mae < 13 mae > 0 mae 0 mae < 13 mae 13 {
            maeIsMM = true;
        } maeIsMM = true maeIsMM true if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        } ushiro > 0 && ushiro < 13 ushiro > 0 ushiro 0 ushiro < 13 ushiro 13 {
            ushiroIsMM = true;
        } ushiroIsMM = true ushiroIsMM true String ans = ""; ans "" if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        } maeIsMM && ushiroIsMM maeIsMM ushiroIsMM {
            ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        } maeIsMM {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        } ushiroIsMM {
            ans = "YYMM";
        } ans = "YYMM" ans "YYMM" {
            ans = "NA";
        } ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int mae = Integer.parseInt(s.substring(0, 2));
        int ushiro = Integer.parseInt(s.substring(2, 4));

        boolean maeIsMM = false;
        boolean ushiroIsMM = false;

        if (mae > 0 && mae < 13) {
            maeIsMM = true;
        }
        if (ushiro > 0 && ushiro < 13) {
            ushiroIsMM = true;
        }


        String ans = "";

        if (maeIsMM && ushiroIsMM) {
            ans = "AMBIGUOUS";
        } else if (maeIsMM) {
            ans = "MMYY";
        } else if (ushiroIsMM) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        // 出力
        System.out.println(ans);
    }
}
