import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int[] array = new int[2]; array new int[2] 2 for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		} {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		} int num = s % 10 * (int) Math.pow(10, i); num s % 10 * (int) Math.pow(10, i) s % 10 s 10 (int) Math.pow(10, i) Math.pow Math 10 i array[1 - i / 2] += num array[1 - i / 2] array 1 - i / 2 1 i / 2 i 2 num s /= 10 s 10 array[0] /= 100 array[0] array 0 100 if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		} array[0] <= 0 || array[0] > 12 array[0] <= 0 array[0] array 0 0 array[0] > 12 array[0] array 0 12 {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			} array[1] <= 0 || array[1] > 12 array[1] <= 0 array[1] array 1 0 array[1] > 12 array[1] array 1 12 {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		} if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			} array[1] <= 0 || array[1] > 12 array[1] <= 0 array[1] array 1 0 array[1] > 12 array[1] array 1 12 {
				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" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
}
