import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	} main {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int s = scan.nextInt(); s scan.nextInt() scan.nextInt scan int l = s / 100; l s / 100 s 100 int r = s % 100; r s % 100 s 100 if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		} l >= 1 && l <= 12 l >= 1 l 1 l <= 12 l 12 {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			} r >= 1 && r <= 12 r >= 1 r 1 r <= 12 r 12 {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		} if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} r >= 1 && r <= 12 r >= 1 r 1 r <= 12 r 12 {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int s = scan.nextInt();
		int l = s / 100;
		int r = s % 100;
		if (l >= 1 && l <= 12) {
			if (r >= 1 && r <= 12) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (r >= 1 && r <= 12) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}
}