//package abc127.B;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	} main {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		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 y = Integer.parseInt("" + s.charAt(0) + s.charAt(1)); y Integer.parseInt("" + s.charAt(0) + s.charAt(1)) Integer.parseInt Integer "" + s.charAt(0) + s.charAt(1) "" + s.charAt(0) + s.charAt(1) "" s.charAt(0) s.charAt s 0 s.charAt(1) s.charAt s 1 int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3)); m Integer.parseInt("" + s.charAt(2) + s.charAt(3)) Integer.parseInt Integer "" + s.charAt(2) + s.charAt(3) "" + s.charAt(2) + s.charAt(3) "" s.charAt(2) s.charAt s 2 s.charAt(3) s.charAt s 3 String ans; ans if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA"; 1 <= y && y <= 12 && 1 <= m && m <= 12 1 <= m 1 <= y && y <= 12 && 1 <= m && m <= 12 1 <= y 1 y y <= 12 y 12 1 <= m 1 m m <= 12 m 12 ans = "AMBIGUOUS" ans "AMBIGUOUS" if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA"; 1 <= m && m <= 12 1 <= m 1 m m <= 12 m 12 ans = "YYMM" ans "YYMM" if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA"; 1 <= y && y <= 12 1 <= y 1 y y <= 12 y 12 ans = "MMYY" ans "MMYY" ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	}

} Main
//package abc127.B;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int y = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
		int m = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
		
		String ans;
		if (1 <= y && y <= 12 && 1 <= m && m <= 12) ans = "AMBIGUOUS";
		else if (1 <= m && m <= 12) ans = "YYMM";
		else if (1 <= y && y <= 12) ans = "MMYY";
		else ans = "NA";
		
		System.out.println(ans);
		
	}

}
