import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
} 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 front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int front = Integer.parseInt(s.substring(0, 2)); front Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int back = Integer.parseInt(s.substring(2)); back Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		} (front >= 1 && 12 >= front) && (back >= 1 && 12 >= back) (front >= 1 && 12 >= front) front >= 1 front 1 12 >= front 12 front (back >= 1 && 12 >= back) back >= 1 back 1 12 >= back 12 back {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		} (front < 1 || 12 < front) && (back < 1 || 12 < back) (front < 1 || 12 < front) front < 1 front 1 12 < front 12 front (back < 1 || 12 < back) back < 1 back 1 12 < back 12 back {
			System.out.println("NA");
		} System.out.println("NA") System.out.println System.out System System.out "NA" if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		} front < 1 || 12 < front front < 1 front 1 12 < front 12 front {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
}
