import java.util.*;

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

        String S = sc.next();
        sc.close();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    }
} 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();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    } 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 int pre = Integer.parseInt(S.substring(0, 2)); pre Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int suf = Integer.parseInt(S.substring(2, 4)); suf Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 String answer = ""; answer "" if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        } 0 < pre && pre <= 12 0 < pre 0 pre pre <= 12 pre 12 {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            } 0 < suf && suf <= 12 0 < suf 0 suf suf <= 12 suf 12 {
                answer = "AMBIGUOUS";
            } answer = "AMBIGUOUS" answer "AMBIGUOUS" {
                answer = "MMYY";
            } answer = "MMYY" answer "MMYY" {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        } if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            } 0 < suf && suf <= 12 0 < suf 0 suf suf <= 12 suf 12 {
                answer = "YYMM";
            } answer = "YYMM" answer "YYMM" {
                answer = "NA";
            } answer = "NA" answer "NA" System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    }
} 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();

        int pre = Integer.parseInt(S.substring(0, 2));

        int suf = Integer.parseInt(S.substring(2, 4));

        String answer = "";

        if (0 < pre && pre <= 12) {
            if (0 < suf && suf <= 12) {
                answer = "AMBIGUOUS";
            } else {
                answer = "MMYY";
            }
        } else {
            if (0 < suf && suf <= 12) {
                answer = "YYMM";
            } else {
                answer = "NA";
            }
        }
        System.out.println(answer);
    }
}