import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	}
} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	} main {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String t = scn.next(); t scn.next() scn.next scn int f = Integer.valueOf(t.substring(0, 2)); f Integer.valueOf(t.substring(0, 2)) Integer.valueOf Integer t.substring(0, 2) t.substring t 0 2 int e = Integer.valueOf(t.substring(2, 4)); e Integer.valueOf(t.substring(2, 4)) Integer.valueOf Integer t.substring(2, 4) t.substring t 2 4 if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} f<=12&&f!=0 f<=12 f 12 f!=0 f 0 {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		} if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} e<=12&&e!=0 e<=12 e 12 e!=0 e 0 {
				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(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		} if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			} e<=12&&e!=0 e<=12 e 12 e!=0 e 0 {
				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" scn.close() scn.close scn String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String t = scn.next();
		int f = Integer.valueOf(t.substring(0, 2));
		int e = Integer.valueOf(t.substring(2, 4));
		if(f<=12&&f!=0) {
			if(e<=12&&e!=0) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else {
			if(e<=12&&e!=0) {
				System.out.println("YYMM");
			}else {
				System.out.println("NA");
			}
		}
		scn.close();
	}
}