import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Integer s = sc.nextInt(); s sc.nextInt() sc.nextInt sc Integer preI = s / 100; preI s / 100 s 100 Integer endI = s % 100; endI s % 100 s 100 boolean isPrePossibleM = 1 <= preI && preI <=12; isPrePossibleM 1 <= preI && preI <=12 1 <= preI 1 preI preI <=12 preI 12 boolean isEndPossibleM = 1 <= endI && endI <=12; isEndPossibleM 1 <= endI && endI <=12 1 <= endI 1 endI endI <=12 endI 12 if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } isPrePossibleM {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            } isEndPossibleM {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            } isEndPossibleM {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
                System.out.println("NA");
            } System.out.println("NA") System.out.println System.out System System.out "NA" String args[] args public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer s = sc.nextInt();
        Integer preI = s / 100;
        Integer endI = s % 100;
        boolean isPrePossibleM = 1 <= preI && preI <=12;
        boolean isEndPossibleM = 1 <= endI && endI <=12;
        if (isPrePossibleM) {
            if (isEndPossibleM) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (isEndPossibleM) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
}