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