import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    } main {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String str = in.nextLine(); str in.nextLine() in.nextLine in int f = Integer.parseInt(str.substring(0, 2)) f Integer.parseInt(str.substring(0, 2)) Integer.parseInt Integer str.substring(0, 2) str.substring str 0 2 t = Integer.parseInt(str.substring(2)); t Integer.parseInt(str.substring(2)) Integer.parseInt Integer str.substring(2) str.substring str 2 if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        } in(f, 1, 12) in f 1 12 {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY") System.out.println System.out System System.out in(t, 1, 12) ? "AMBIGUOUS" : "MMYY" in(t, 1, 12) in t 1 12 "AMBIGUOUS" "MMYY" {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        } System.out.println(in(t, 1, 12) ? "YYMM" : "NA") System.out.println System.out System System.out in(t, 1, 12) ? "YYMM" : "NA" in(t, 1, 12) in t 1 12 "YYMM" "NA" String[] args args public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    } in {
        return start <= value && value <= end;
    } return start <= value && value <= end; start <= value && value <= end start <= value start value value <= end value end int value value int start start int end end public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
} Main
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int f = Integer.parseInt(str.substring(0, 2)), t = Integer.parseInt(str.substring(2));
        if (in(f, 1, 12)) {
            System.out.println(in(t, 1, 12) ? "AMBIGUOUS" : "MMYY");
        } else {
            System.out.println(in(t, 1, 12) ? "YYMM" : "NA");
        }
    }

    public static boolean in(int value, int start, int end) {
        return start <= value && value <= end;
    }
}
