import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    }
} 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 yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int yono = 0; yono 0 if(s / 100 < 13 && s / 100 > 0){
            yono++;
        } s / 100 < 13 && s / 100 > 0 s / 100 < 13 s / 100 s 100 13 s / 100 > 0 s / 100 s 100 0 {
            yono++;
        } yono++ yono if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        } s % 100 < 13 && s % 100 > 0 s % 100 < 13 s % 100 s 100 13 s % 100 > 0 s % 100 s 100 0 {
            yono += 2;
        } yono += 2 yono 2 if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        } yono == 0 yono 0 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        } yono == 1 yono 1 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        } yono == 2 yono 2 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int yono = 0;
        if(s / 100 < 13 && s / 100 > 0){
            yono++;
        }
        if(s % 100 < 13 && s % 100 > 0){
            yono += 2;
        }
        if(yono == 0){
            System.out.println("NA");
        }else if(yono == 1){
            System.out.println("MMYY");
        }else if(yono == 2){
            System.out.println("YYMM");
        }else{
            System.out.println("AMBIGUOUS");
        }
        sc.close();
    }
}