import java.util.Scanner;

public class Main {

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

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

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