import java.util.*;
public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    }
} Main public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    } main {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String s = sc.next(); s sc.next() sc.next sc final int si1 = Integer.parseInt(s.substring(0, 2)); si1 Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 final int si2 = Integer.parseInt(s.substring(2, 4)); si2 Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 Boolean isYyMm = (1 <= si2 && si2 <= 12); isYyMm (1 <= si2 && si2 <= 12) 1 <= si2 1 si2 si2 <= 12 si2 12 Boolean isMmYy = (1 <= si1 && si1 <= 12); isMmYy (1 <= si1 && si1 <= 12) 1 <= si1 1 si1 si1 <= 12 si1 12 if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        } isYyMm && isMmYy isYyMm isMmYy {
            System.out.print("AMBIGUOUS");
        } System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        } isYyMm {
            System.out.print("YYMM");
        } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        } isMmYy {
            System.out.print("MMYY");
        } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" {
            System.out.print("NA");
        } System.out.print("NA") System.out.print System.out System System.out "NA" final String[] args args public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    }
} public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    }
} Main
import java.util.*;
public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String s = sc.next();
        final int si1 = Integer.parseInt(s.substring(0, 2));
        final int si2 = Integer.parseInt(s.substring(2, 4));
        Boolean isYyMm = (1 <= si2 && si2 <= 12);
        Boolean isMmYy = (1 <= si1 && si1 <= 12);
        if (isYyMm && isMmYy) {
            System.out.print("AMBIGUOUS");
        } else if (isYyMm) {
            System.out.print("YYMM");
        } else if (isMmYy) {
            System.out.print("MMYY");
        } else {
            System.out.print("NA");
        }
    }
}
