import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
} Main public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
} main {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int former = Integer.parseInt(s.substring(0,2)); former Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int later = Integer.parseInt(s.substring(2,4)); later Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 boolean a = false; a false boolean b = false; b false if(former > 0 && former <= 12) a = true; former > 0 && former <= 12 former > 0 former 0 former <= 12 former 12 a = true a true if(later > 0 && later <= 12) b = true; later > 0 && later <= 12 later > 0 later 0 later <= 12 later 12 b = true b true if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	} a && b a b {
		System.out.println("AMBIGUOUS");
	} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	} a && !b a !b b {
		System.out.println("MMYY");
	} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	} !a && b !a a b {
		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);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
} public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
}
