import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            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);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        }
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        }
    } main {
		Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(sc.next()) sb.append sb sc.next() sc.next sc String str1 = sb.substring(0,2); str1 sb.substring(0,2) sb.substring sb 0 2 String str2 = sb.substring(2,4); str2 sb.substring(2,4) sb.substring sb 2 4 int i = Integer.parseInt(str1); i Integer.parseInt(str1) Integer.parseInt Integer str1 int j = Integer.parseInt(str2); j Integer.parseInt(str2) Integer.parseInt Integer str2 if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        } 0 < i && i < 13 0 < i 0 i i < 13 i 13 {
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          } 0 < j && j < 13 0 < j 0 j j < 13 j 13 {
            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(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        } if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          } 0 < j && j < 13 0 < j 0 j j < 13 j 13 {
            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);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        }
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            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);
        StringBuilder sb = new StringBuilder();
        sb.append(sc.next());
        String str1 = sb.substring(0,2);
        String str2 = sb.substring(2,4);
        int i = Integer.parseInt(str1);
        int j = Integer.parseInt(str2);

        if(0 < i && i < 13){
          if(0 < j && j < 13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        }else{
          if(0 < j && j < 13){
            System.out.println("YYMM");
          }else{
            System.out.println("NA");
          }
        }
    }
}
