import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			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 String a = s.substring(0,2); a s.substring(0,2) s.substring s 0 2 String b = s.substring(2,4); b s.substring(2,4) s.substring s 2 4 int t = Integer.parseInt(a); t Integer.parseInt(a) Integer.parseInt Integer a int r = Integer.parseInt(b); r Integer.parseInt(b) Integer.parseInt Integer b if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		} 1<=t && t<=12 1<=t 1 t t<=12 t 12 {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		} if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			} 1<=r && r<=12 1<=r 1 r r<=12 r 12 {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(r>12 || r==0) {
				System.out.println("MMYY");
			} r>12 || r==0 r>12 r 12 r==0 r 0 {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		} (1<=r && r<=12 )&&( t > 12 || t == 0) (1<=r && r<=12 ) 1<=r 1 r r<=12 r 12 ( t > 12 || t == 0) t > 12 t 12 t == 0 t 0 {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		} (r>12 || r == 0) && (t >12 || t ==0) (r>12 || r == 0) r>12 r 12 r == 0 r 0 (t >12 || t ==0) t >12 t 12 t ==0 t 0 {
			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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
				
		String s = sc.next();
		
		String a = s.substring(0,2);
		String b = s.substring(2,4);
		
		int t = Integer.parseInt(a);
		int r = Integer.parseInt(b);
		
		if(1<=t && t<=12) {
			if(1<=r && r<=12) {
				System.out.println("AMBIGUOUS");
			}
			if(r>12 || r==0) {
				System.out.println("MMYY");
			}
		}
		if((1<=r && r<=12 )&&( t > 12 || t == 0)) {
			System.out.println("YYMM");
		}
		if((r>12 || r == 0) && (t >12 || t ==0)) {
			System.out.println("NA");
		}
				
		}
}
