import java.util.Scanner;

public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

} Main public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	} run {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) StringBuilder str = new StringBuilder(scan.next()); str new StringBuilder(scan.next()) int p = Integer.parseInt(str.substring(0, 2)); p Integer.parseInt(str.substring(0, 2)) Integer.parseInt Integer str.substring(0, 2) str.substring str 0 2 int s = Integer.parseInt(str.substring(2, 4)); s Integer.parseInt(str.substring(2, 4)) Integer.parseInt Integer str.substring(2, 4) str.substring str 2 4 if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		} p == 0 && s < 13 p == 0 p 0 s < 13 s 13 {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		} if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM"); s == 0 s 0 System.out.println("NA") System.out.println System.out System System.out "NA" System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		} s == 0 && p < 13 s == 0 s 0 p < 13 p 13 {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		} if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY"); p == 0 p 0 System.out.println("NA") System.out.println System.out System System.out "NA" System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		} s == 0 || p == 0 s == 0 s 0 p == 0 p 0 {
			System.out.println("NA");
			return;
		} System.out.println("NA") System.out.println System.out System System.out "NA" return; if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		} p > 12 p 12 {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM"); s > 12 s 12 System.out.println("NA") System.out.println System.out System System.out "NA" System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		} if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS"); s > 12 s 12 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

} public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

} Main
import java.util.Scanner;

public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder(scan.next());
		int p = Integer.parseInt(str.substring(0, 2));
		int s = Integer.parseInt(str.substring(2, 4));

		if (p == 0 && s < 13) {
			if (s == 0)
				System.out.println("NA");
			else
				System.out.println("YYMM");
			return;
		}
		if (s == 0 && p < 13) {
			if (p == 0)
				System.out.println("NA");
			else
				System.out.println("MMYY");
			return;
		}
		if (s == 0 || p == 0) {
			System.out.println("NA");
			return;
		}

		if (p > 12) {
			if (s > 12)
				System.out.println("NA");
			else
				System.out.println("YYMM");
		} else {
			if (s > 12)
				System.out.println("MMYY");
			else
				System.out.println("AMBIGUOUS");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

}
