
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2));
		
		String ans = "NA";
		if ((a >= 1 && a<= 12) && (b >= 1 && b<= 12)) {
			ans = "AMBIGUOUS";
		} else if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} 
		System.out.println(ans);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2));
		
		String ans = "NA";
		if ((a >= 1 && a<= 12) && (b >= 1 && b<= 12)) {
			ans = "AMBIGUOUS";
		} else if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} 
		System.out.println(ans);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2));
		
		String ans = "NA";
		if ((a >= 1 && a<= 12) && (b >= 1 && b<= 12)) {
			ans = "AMBIGUOUS";
		} else if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} 
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2));
		
		String ans = "NA";
		if ((a >= 1 && a<= 12) && (b >= 1 && b<= 12)) {
			ans = "AMBIGUOUS";
		} else if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} 
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int a = Integer.parseInt(s.substring(0, 2)); a Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int b = Integer.parseInt(s.substring(2)); b Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 String ans = "NA"; ans "NA" if ((a >= 1 && a<= 12) && (b >= 1 && b<= 12)) {
			ans = "AMBIGUOUS";
		} else if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} (a >= 1 && a<= 12) && (b >= 1 && b<= 12) (a >= 1 && a<= 12) a >= 1 a 1 a<= 12 a 12 (b >= 1 && b<= 12) b >= 1 b 1 b<= 12 b 12 {
			ans = "AMBIGUOUS";
		} ans = "AMBIGUOUS" ans "AMBIGUOUS" if (a >= 1 && a<= 12) {
			ans = "MMYY";
		} else if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} a >= 1 && a<= 12 a >= 1 a 1 a<= 12 a 12 {
			ans = "MMYY";
		} ans = "MMYY" ans "MMYY" if (b >= 1 && b<= 12) {
			ans = "YYMM";
		} b >= 1 && b<= 12 b >= 1 b 1 b<= 12 b 12 {
			ans = "YYMM";
		} ans = "YYMM" ans "YYMM" System.out.println(ans) System.out.println System.out System System.out ans String args[] args

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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