import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            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 String ans; ans int s1 = Integer.parseInt(s.substring(0, 2)); s1 Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int s2 = Integer.parseInt(s.substring(2, 4)); s2 Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        } 1 <= s1 && s1 <= 12 1 <= s1 1 s1 s1 <= 12 s1 12 {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } ans = "MMYY" ans "MMYY" if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            } 1 <= s2 && s2 <= 12 1 <= s2 1 s2 s2 <= 12 s2 12 {
                ans = "AMBIGUOUS";
            } ans = "AMBIGUOUS" ans "AMBIGUOUS" if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        } 1 <= s2 && s2 <= 12 1 <= s2 1 s2 s2 <= 12 s2 12 {
            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) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans;
        int s1 = Integer.parseInt(s.substring(0, 2));
        int s2 = Integer.parseInt(s.substring(2, 4));
        if (1 <= s1 && s1 <= 12) {
            ans = "MMYY";
            if (1 <= s2 && s2 <= 12) {
                ans = "AMBIGUOUS";
            }
        } else if (1 <= s2 && s2 <= 12) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }
}