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

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
        int n[] = new int[2];
        int d = 100;
      
     for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;}
     if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     else{System.out.print("NA");}
      

	} main {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
        int n[] = new int[2];
        int d = 100;
      
     for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;}
     if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     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 n[] = new int[2]; n new int[2] 2 int d = 100; d 100 for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;} int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {n[i]=(S/d);S%=d;d/=100;} {n[i]=(S/d);S%=d;d/=100;} n[i]=(S/d) n[i] n i (S/d) S d S%=d S d d/=100 d 100 if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     else{System.out.print("NA");} n[1]>00&&n[1]<13 n[1]>00 n[1] n 1 00 n[1]<13 n[1] n 1 13 {
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     } if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");} n[0]>00&&n[0]<13 n[0]>00 n[0] n 0 00 n[0]<13 n[0] n 0 13 {System.out.print("AMBIGUOUS");} System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" {System.out.print("YYMM");} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     else{System.out.print("NA");} n[0]>00&&n[0]<13 n[0]>00 n[0] n 0 00 n[0]<13 n[0] n 0 13 {System.out.print("MMYY");} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" {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 n[] = new int[2];
        int d = 100;
      
     for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;}
     if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     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 n[] = new int[2];
        int d = 100;
      
     for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;}
     if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     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 n[] = new int[2];
        int d = 100;
      
     for (int i = 0; i < 2; i++) {n[i]=(S/d);S%=d;d/=100;}
     if(n[1]>00&&n[1]<13){
        if(n[0]>00&&n[0]<13){System.out.print("AMBIGUOUS");}
       else{System.out.print("YYMM");}
     }
     else if(n[0]>00&&n[0]<13){System.out.print("MMYY");}
     else{System.out.print("NA");}
      

	}
}
