import java.util.Scanner;

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

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    }
} Main public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    } main {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String s1 = s.substring(0, 2); s1 s.substring(0, 2) s.substring s 0 2 String s2 = s.substring(2, 4); s2 s.substring(2, 4) s.substring s 2 4 int i1 = Integer.parseInt(s1); i1 Integer.parseInt(s1) Integer.parseInt Integer s1 int i2 = Integer.parseInt(s2); i2 Integer.parseInt(s2) Integer.parseInt Integer s2 String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA"; result (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA" (i1 > 0 && i1 <= 12) i1 > 0 i1 0 i1 <= 12 i1 12 (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY" (i2 > 0 && i2 <= 12) i2 > 0 i2 0 i2 <= 12 i2 12 "AMBIGUOUS" "MMYY" (i2 > 0 && i2 <= 12) ? "YYMM" : "NA" (i2 > 0 && i2 <= 12) i2 > 0 i2 0 i2 <= 12 i2 12 "YYMM" "NA" 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 scan = new Scanner(System.in);
        String s = scan.next();

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    }
} public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    }
} Main
import java.util.Scanner;

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

        String s1 = s.substring(0, 2);
        String s2 = s.substring(2, 4);
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);

        String result = (i1 > 0 && i1 <= 12) ? (i2 > 0 && i2 <= 12) ? "AMBIGUOUS" : "MMYY"
                : (i2 > 0 && i2 <= 12) ? "YYMM" : "NA";
        System.out.println(result);
    }
}