import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc boolean yymm = true yymm true mmyy = true; mmyy true if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false; Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0 Integer.parseInt(S.substring(0,2)) > 12 Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 12 Integer.parseInt(S.substring(0,2)) <= 0 Integer.parseInt(S.substring(0,2)) Integer.parseInt Integer S.substring(0,2) S.substring S 0 2 0 mmyy = false mmyy false if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false; Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0 Integer.parseInt(S.substring(2,4)) > 12 Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 12 Integer.parseInt(S.substring(2,4)) <= 0 Integer.parseInt(S.substring(2,4)) Integer.parseInt Integer S.substring(2,4) S.substring S 2 4 0 yymm = false yymm false if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA"); mmyy System.out.println(yymm ? "AMBIGUOUS" : "MMYY") System.out.println System.out System System.out yymm ? "AMBIGUOUS" : "MMYY" yymm "AMBIGUOUS" "MMYY" System.out.println(yymm ? "YYMM" : "NA") System.out.println System.out System System.out yymm ? "YYMM" : "NA" yymm "YYMM" "NA" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		boolean yymm = true, mmyy = true;
		if(Integer.parseInt(S.substring(0,2)) > 12 || Integer.parseInt(S.substring(0,2)) <= 0)
			mmyy = false;
		if(Integer.parseInt(S.substring(2,4)) > 12 || Integer.parseInt(S.substring(2,4)) <= 0)
			yymm = false;
		if(mmyy)
			System.out.println(yymm ? "AMBIGUOUS" : "MMYY");
		else
			System.out.println(yymm ? "YYMM" : "NA");
	}

}