
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	}

} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	}

} Main public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int a1 = Integer.parseInt(s.substring(0, 2)); a1 Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int a2 = Integer.parseInt(s.substring(2, 4)); a2 Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 boolean m1 = false; m1 false if(1<=a1 && a1 <= 12) {
			m1=true;
		} 1<=a1 && a1 <= 12 1<=a1 1 a1 a1 <= 12 a1 12 {
			m1=true;
		} m1=true m1 true boolean m2 = false; m2 false if(1<=a2 && a2 <= 12) {
			m2=true;
		} 1<=a2 && a2 <= 12 1<=a2 1 a2 a2 <= 12 a2 12 {
			m2=true;
		} m2=true m2 true String ans = ""; ans "" if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		} m1 && m2 m1 m2 {
			ans = "AMBIGUOUS";
		} ans = "AMBIGUOUS" ans "AMBIGUOUS" if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		} m1 && ! m2 m1 ! m2 m2 {
			ans = "MMYY";
		} ans = "MMYY" ans "MMYY" if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		} ! m1 && m2 ! m1 m1 m2 {
			ans = "YYMM";
		} ans = "YYMM" ans "YYMM" {
			ans = "NA";
		} ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	}

} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	}

} Main

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int a1 = Integer.parseInt(s.substring(0, 2));
		int a2 = Integer.parseInt(s.substring(2, 4));

		boolean m1 = false;
		if(1<=a1 && a1 <= 12) {
			m1=true;
		}
		boolean m2 = false;
		if(1<=a2 && a2 <= 12) {
			m2=true;
		}

		String ans = "";
		if(m1 && m2) {
			ans = "AMBIGUOUS";
		}else if(m1 && ! m2) {
			ans = "MMYY";
		}else if(! m1 && m2) {
			ans = "YYMM";
		}else {
			ans = "NA";
		}
		System.out.println(ans);
		sc.close();
	}

}
