
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
} Main public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	} main {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	} @SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) final String S = in.next(); S in.next() in.next in String judge = solve(S); judge solve(S) solve S System.out.println(judge.trim()) System.out.println System.out System System.out judge.trim() judge.trim judge final String[] args args public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	} isPossibleMonth {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	} final int val = Integer.parseInt(m); val Integer.parseInt(m) Integer.parseInt Integer m return val <= 12 && val >= 1; val <= 12 && val >= 1 val <= 12 val 12 val >= 1 val 1 String m m static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	} solve {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	} final boolean headIsMonth = isPossibleMonth(S.substring(0, 2)); headIsMonth isPossibleMonth(S.substring(0, 2)) isPossibleMonth S.substring(0, 2) S.substring S 0 2 final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4)); tailIsMonth isPossibleMonth(S.substring(2, 4)) isPossibleMonth S.substring(2, 4) S.substring S 2 4 if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		} headIsMonth {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			} tailIsMonth {
				return "AMBIGUOUS";
			} return "AMBIGUOUS"; "AMBIGUOUS" {
				return "MMYY";
			} return "MMYY"; "MMYY" {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		} if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			} tailIsMonth {
				return "YYMM";
			} return "YYMM"; "YYMM" {
				return "NA";
			} return "NA"; "NA" final String S S public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
} public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		@SuppressWarnings("resource")
		final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		final String S = in.next();
		String judge = solve(S);
		System.out.println(judge.trim());
	}

	public static boolean isPossibleMonth(String m) {
		final int val = Integer.parseInt(m);
		return val <= 12 && val >= 1;
	}

	static String solve(final String S) {
		final boolean headIsMonth = isPossibleMonth(S.substring(0, 2));
		final boolean tailIsMonth = isPossibleMonth(S.substring(2, 4));
		if (headIsMonth) {
			if (tailIsMonth) {
				return "AMBIGUOUS";
			} else {
				return "MMYY";
			}
		} else {
			if (tailIsMonth) {
				return "YYMM";
			} else {
				return "NA";
			}
		}
	}
}
