import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int first = input / 100;
        int latter = input % 100;

        boolean firstMonth = first > 0 && first <= 12;
        boolean latterMonth = latter > 0 && latter <= 12;
        if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA");
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int first = input / 100;
        int latter = input % 100;

        boolean firstMonth = first > 0 && first <= 12;
        boolean latterMonth = latter > 0 && latter <= 12;
        if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int first = input / 100;
        int latter = input % 100;

        boolean firstMonth = first > 0 && first <= 12;
        boolean latterMonth = latter > 0 && latter <= 12;
        if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA");
    } main {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int first = input / 100;
        int latter = input % 100;

        boolean firstMonth = first > 0 && first <= 12;
        boolean latterMonth = latter > 0 && latter <= 12;
        if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc int first = input / 100; first input / 100 input 100 int latter = input % 100; latter input % 100 input 100 boolean firstMonth = first > 0 && first <= 12; firstMonth first > 0 && first <= 12 first > 0 first 0 first <= 12 first 12 boolean latterMonth = latter > 0 && latter <= 12; latterMonth latter > 0 && latter <= 12 latter > 0 latter 0 latter <= 12 latter 12 if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA"); firstMonth && latterMonth firstMonth latterMonth System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA"); firstMonth System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA"); latterMonth System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int first = input / 100;
        int latter = input % 100;

        boolean firstMonth = first > 0 && first <= 12;
        boolean latterMonth = latter > 0 && latter <= 12;
        if(firstMonth && latterMonth)System.out.println("AMBIGUOUS");
        else if(firstMonth)System.out.println("MMYY");
        else if(latterMonth)System.out.println("YYMM");
        else System.out.println("NA");
    }
}