

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int yy = S / 100; yy S / 100 S 100 int mm = S % 100; mm S % 100 S 100 if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} 1 <= yy && yy <= 12 1 <= yy 1 yy yy <= 12 yy 12 {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		} if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} 1 <= mm && mm <= 12 1 <= mm 1 mm mm <= 12 mm 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(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} 1 <= mm && mm <= 12 1 <= mm 1 mm mm <= 12 mm 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	}

} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int yy = S / 100;
		int mm = S % 100;

		if(1 <= yy && yy <= 12) {
			if(1 <= mm && mm <= 12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(1 <= mm && mm <= 12) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}

	}

}
