import java.util.Scanner;

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

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

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

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

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

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

        if ((a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0)) {
            System.out.println("NA");
        } else {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

        if ((a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0)) {
            System.out.println("NA");
        } else {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int a = Integer.parseInt(s.substring(0, 2)); a Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int b = Integer.parseInt(s.substring(2, 4)); b Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if ((a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0)) {
            System.out.println("NA");
        } else {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        } (a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0) (a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0) (a == 0 && b == 0) a == 0 a 0 b == 0 b 0 (a > 12 && b == 0) a > 12 a 12 b == 0 b 0 (b > 12 && a == 0) b > 12 b 12 a == 0 a 0 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        } if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            } a <= 12 && b <= 12 a <= 12 a 12 b <= 12 b 12 {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS"); a == 0 a 0 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS"); b == 0 b 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            } a > 12 && b <= 12 a > 12 a 12 b <= 12 b 12 {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            } a <= 12 && b > 12 a <= 12 a 12 b > 12 b 12 {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
                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 sc = new Scanner(System.in);

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

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

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

        if ((a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0)) {
            System.out.println("NA");
        } else {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main
import java.util.Scanner;

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

        String s = sc.next();

        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));

        if ((a == 0 && b == 0) || (a > 12 && b == 0) || (b > 12 && a == 0)) {
            System.out.println("NA");
        } else {
            if (a <= 12 && b <= 12) {
                if (a == 0)
                    System.out.println("YYMM");
                else if (b == 0)
                    System.out.println("MMYY");
                else
                    System.out.println("AMBIGUOUS");
            } else if (a > 12 && b <= 12) {
                System.out.println("YYMM");
            } else if (a <= 12 && b > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("NA");
            }
        }
    }
}