import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    }
} 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 forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    } main {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int forward = Integer.parseInt(s.substring(0, 2)); forward Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int back = Integer.parseInt(s.substring(2)); back Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 String result = "NA"; result "NA" if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        } forward <= 12 && forward > 0 && back <= 12 && back > 0 back <= 12 forward <= 12 && forward > 0 && back <= 12 && back > 0 forward <= 12 forward 12 forward > 0 forward 0 back <= 12 back 12 back > 0 back 0 {
            result = "AMBIGUOUS";
        } result = "AMBIGUOUS" result "AMBIGUOUS" if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        } back <= 12 && back > 0 back <= 12 back 12 back > 0 back 0 {
            result = "YYMM";
        } result = "YYMM" result "YYMM" if (forward <= 12 && forward > 0) {
            result = "MMYY";
        } forward <= 12 && forward > 0 forward <= 12 forward 12 forward > 0 forward 0 {
            result = "MMYY";
        } result = "MMYY" result "MMYY" System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    }
} 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 forward = Integer.parseInt(s.substring(0, 2));
        int back = Integer.parseInt(s.substring(2));

        String result = "NA";
        if (forward <= 12 && forward > 0 && back <= 12 && back > 0) {
            result = "AMBIGUOUS";
        } else if (back <= 12 && back > 0) {
            result = "YYMM";
        } else if (forward <= 12 && forward > 0) {
            result = "MMYY";
        }

        System.out.println(result);
    }
}