import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	}
} Main public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	} main {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	} try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		} catch (IOException e1) {
		} IOException e1 {
		} {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} String input = new BufferedReader(new InputStreamReader(System.in)).readLine(); input new BufferedReader(new InputStreamReader(System.in)).readLine() new BufferedReader(new InputStreamReader(System.in)).readLine new BufferedReader(new InputStreamReader(System.in)) int pre = Integer.parseInt(input.substring(0, 2)); pre Integer.parseInt(input.substring(0, 2)) Integer.parseInt Integer input.substring(0, 2) input.substring input 0 2 int pro = Integer.parseInt(input.substring(2)); pro Integer.parseInt(input.substring(2)) Integer.parseInt Integer input.substring(2) input.substring input 2 boolean preIn12 = (0 < pre && pre <= 12); preIn12 (0 < pre && pre <= 12) 0 < pre 0 pre pre <= 12 pre 12 boolean proIn12 = (0 < pro && pro <= 12); proIn12 (0 < pro && pro <= 12) 0 < pro 0 pro pro <= 12 pro 12 String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA"))); ret (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA"))) preIn12 && proIn12 preIn12 proIn12 "AMBIGUOUS" (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")) proIn12 "YYMM" (preIn12 ? "MMYY"
								  : "NA") preIn12 "MMYY" "NA" System.out.println(ret) System.out.println System.out System System.out ret String[] args args public class Main {
	public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	}
} public class Main {
	public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
			int pre = Integer.parseInt(input.substring(0, 2));
			int pro = Integer.parseInt(input.substring(2));
			boolean preIn12 = (0 < pre && pre <= 12);
			boolean proIn12 = (0 < pro && pro <= 12);

			String ret = (preIn12 && proIn12 ? "AMBIGUOUS"
								  : (proIn12 ? "YYMM"
								  : (preIn12 ? "MMYY"
								  : "NA")));
			System.out.println(ret);
		} catch (IOException e1) {
		}
	}
}
