import java.util.Scanner;

public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
} Main final static String YYMM = "YYMM"; YYMM "YYMM" final static String MMYY = "MMYY"; MMYY "MMYY" final static String AMBIGUOUS = "AMBIGUOUS"; AMBIGUOUS "AMBIGUOUS" final static String NA = "NA"; NA "NA" final static String patern = "uuMMdd"; patern "uuMMdd" final static String day = "01"; day "01" public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	} main {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		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 sc.close() sc.close sc boolean yymm = false yymm false mmyy =false; mmyy false int a = S / 100; a S / 100 S 100 int b = S % 100; b S % 100 S 100 if(b >= 1 && b <= 12) yymm = true; b >= 1 && b <= 12 b >= 1 b 1 b <= 12 b 12 yymm = true yymm true if(a >= 1 && a <= 12) mmyy = true; a >= 1 && a <= 12 a >= 1 a 1 a <= 12 a 12 mmyy = true mmyy true if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA); yymm && mmyy yymm mmyy System.out.println(AMBIGUOUS) System.out.println System.out System System.out AMBIGUOUS if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA); yymm System.out.println(YYMM) System.out.println System.out System System.out YYMM if(mmyy) System.out.println(MMYY);
		else System.out.println(NA); mmyy System.out.println(MMYY) System.out.println System.out System System.out MMYY System.out.println(NA) System.out.println System.out System System.out NA final String[] args args public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
} public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
} Main
import java.util.Scanner;

public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		sc.close();
		boolean yymm = false, mmyy =false;
		int a = S / 100;
		int b = S % 100;
		// YYMM
		if(b >= 1 && b <= 12) yymm = true;
		// MMYY
		if(a >= 1 && a <= 12) mmyy = true;
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
}