import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) 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 sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA");
	} main {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) 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 boolean l = 1 <= S / 100 && S / 100 <= 12 l 1 <= S / 100 && S / 100 <= 12 1 <= S / 100 1 S / 100 S 100 S / 100 <= 12 S / 100 S 100 12 r = 1 <= S % 100 && S % 100 <= 12; r 1 <= S % 100 && S % 100 <= 12 1 <= S % 100 1 S % 100 S 100 S % 100 <= 12 S % 100 S 100 12 if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA"); l && r l r System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA"); l && !r l !r r System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (!l && r) System.out.println("YYMM");
		else System.out.println("NA"); !l && r !l l r System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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 sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA");
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		boolean l = 1 <= S / 100 && S / 100 <= 12, r = 1 <= S % 100 && S % 100 <= 12;
		if (l && r) System.out.println("AMBIGUOUS");
		else if (l && !r) System.out.println("MMYY");
		else if (!l && r) System.out.println("YYMM");
		else System.out.println("NA");
	}
}