import java.util.*;

public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    } main {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int upper = s / 100; upper s / 100 s 100 int lower = s % 100; lower s % 100 s 100 if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        } (upper == 00) & (01 <= lower & lower <= 12) (upper == 00) upper 00 (01 <= lower & lower <= 12) 01 <= lower 01 lower lower <= 12 lower 12 {
            System.out.print("YYMM");
        } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        } (13 <= upper & upper <= 99) & (01 <= lower & lower <= 12) (13 <= upper & upper <= 99) 13 <= upper 13 upper upper <= 99 upper 99 (01 <= lower & lower <= 12) 01 <= lower 01 lower lower <= 12 lower 12 {
            System.out.print("YYMM");
        } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        } (01 <= upper & upper <= 12) & (lower == 00) (01 <= upper & upper <= 12) 01 <= upper 01 upper upper <= 12 upper 12 (lower == 00) lower 00 {
            System.out.print("MMYY");
        } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        } (01 <= upper & upper <= 12) & (13 <= lower & lower <= 99) (01 <= upper & upper <= 12) 01 <= upper 01 upper upper <= 12 upper 12 (13 <= lower & lower <= 99) 13 <= lower 13 lower lower <= 99 lower 99 {
            System.out.print("MMYY");
        } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        } (01 <= upper & upper <= 12) & (01 <= lower & lower <= 12) (01 <= upper & upper <= 12) 01 <= upper 01 upper upper <= 12 upper 12 (01 <= lower & lower <= 12) 01 <= lower 01 lower lower <= 12 lower 12 {
            System.out.print("AMBIGUOUS");
        } System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" {
            System.out.print("NA");
        } System.out.print("NA") System.out.print System.out System System.out "NA" String args[] args public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    }
} public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int s = sc.nextInt();

        int upper = s / 100;
        int lower = s % 100;

        if ((upper == 00) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((13 <= upper & upper <= 99) & (01 <= lower & lower <= 12)){
            System.out.print("YYMM");
        }else if ((01 <= upper & upper <= 12) & (lower == 00)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (13 <= lower & lower <= 99)){
            System.out.print("MMYY");
        }else if ((01 <= upper & upper <= 12) & (01 <= lower & lower <= 12)){
            System.out.print("AMBIGUOUS");
        }else{
            System.out.print("NA");
        }




    }
}
