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