import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		String S = sc.get();
		int left = Integer.parseInt(S.substring(0, 2), 10);
		int right = Integer.parseInt(S.substring(2), 10);
		if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
	
	boolean isYear(int n) {
		return n > 12 || n <= 0;
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	}
} Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		} StringTokenizer line; line public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			} get {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			} try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				} IOException e {
					throw new UncheckedIOException(e);
				} throw new UncheckedIOException(e); new UncheckedIOException(e) {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken(); (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken() (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())) line line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine()) line != null && line.hasMoreTokens() line != null line null line.hasMoreTokens() line.hasMoreTokens line line new StringTokenizer(reader.readLine()) import java.io.*; io.* java import java.util.*; util.* java import java.util.function.*; function.* java.util final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		String S = sc.get();
		int left = Integer.parseInt(S.substring(0, 2), 10);
		int right = Integer.parseInt(S.substring(2), 10);
		if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
	
	boolean isYear(int n) {
		return n > 12 || n <= 0;
	}
} Solver static final Solver INSTANCE = new Solver(); INSTANCE new Solver() void solve(Supplier<String> sc) {
		String S = sc.get();
		int left = Integer.parseInt(S.substring(0, 2), 10);
		int right = Integer.parseInt(S.substring(2), 10);
		if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	} solve {
		String S = sc.get();
		int left = Integer.parseInt(S.substring(0, 2), 10);
		int right = Integer.parseInt(S.substring(2), 10);
		if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	} String S = sc.get(); S sc.get() sc.get sc int left = Integer.parseInt(S.substring(0, 2), 10); left Integer.parseInt(S.substring(0, 2), 10) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 10 int right = Integer.parseInt(S.substring(2), 10); right Integer.parseInt(S.substring(2), 10) Integer.parseInt Integer S.substring(2) S.substring S 2 10 if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		} isYear(left) && isYear(right) isYear(left) isYear left isYear(right) isYear right {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		} isYear(left) isYear left {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		} isYear(right) isYear right {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" Supplier<String> sc sc boolean isYear(int n) {
		return n > 12 || n <= 0;
	} isYear {
		return n > 12 || n <= 0;
	} return n > 12 || n <= 0; n > 12 || n <= 0 n > 12 n 12 n <= 0 n 0 int n n class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	}
} Main public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	} main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		}) Solver.INSTANCE.solve Solver.INSTANCE Solver Solver.INSTANCE new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		} String... args args
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		String S = sc.get();
		int left = Integer.parseInt(S.substring(0, 2), 10);
		int right = Integer.parseInt(S.substring(2), 10);
		if (isYear(left) && isYear(right)) {
			System.out.println("NA");
		} else if (isYear(left)){
			System.out.println("YYMM");
		} else if (isYear(right)) {
			System.out.println("MMYY");
		} else {
			System.out.println("AMBIGUOUS");
		}
	}
	
	boolean isYear(int n) {
		return n > 12 || n <= 0;
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	}
}