/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	} main {
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) char[] s = scan.next().toCharArray(); s scan.next().toCharArray() scan.next().toCharArray scan.next() scan.next scan int x x y; y x = (s[0]-'0')*10 +(s[1]-'0') x (s[0]-'0')*10 +(s[1]-'0') (s[0]-'0')*10 (s[0]-'0') s[0] s 0 '0' 10 (s[1]-'0') s[1] s 1 '0' y = (s[2]-'0')*10 + (s[3] - '0') y (s[2]-'0')*10 + (s[3] - '0') (s[2]-'0')*10 (s[2]-'0') s[2] s 2 '0' 10 (s[3] - '0') s[3] s 3 '0' int mask= 0; mask 0 if(x<=12&&x>0){
			mask |= 1;
		} x<=12&&x>0 x<=12 x 12 x>0 x 0 {
			mask |= 1;
		} mask |= 1 mask 1 if(y<=12&&y>0){
			mask |=2;
			
		} y<=12&&y>0 y<=12 y 12 y>0 y 0 {
			mask |=2;
			
		} mask |=2 mask 2 if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		} mask==3 mask 3 {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		} mask==2 mask 2 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		} mask==1 mask 1 {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args
/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		int x,y;
		x = (s[0]-'0')*10 +(s[1]-'0');
		y = (s[2]-'0')*10 + (s[3] - '0');// your code goes here
		int mask= 0;
		if(x<=12&&x>0){
			mask |= 1;
		}
		if(y<=12&&y>0){
			mask |=2;
			
		}
		if(mask==3){
			System.out.println("AMBIGUOUS");
		}else if(mask==2){
			System.out.println("YYMM");
		}else if(mask==1){
			System.out.println("MMYY");
		}else{
			System.out.println("NA");
		}
		
		
		
	}
}