import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("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 isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA");

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA");

	} main {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc boolean isMMYY = true; isMMYY true boolean isYYMM = true; isYYMM true String frontStr = s.substring(0,2); frontStr s.substring(0,2) s.substring s 0 2 String backStr = s.substring(2,4); backStr s.substring(2,4) s.substring s 2 4 int frontInt = Integer.parseInt(frontStr); frontInt Integer.parseInt(frontStr) Integer.parseInt Integer frontStr int backInt = Integer.parseInt(backStr); backInt Integer.parseInt(backStr) Integer.parseInt Integer backStr if (frontInt == 0 || frontInt > 12) isMMYY = false; frontInt == 0 || frontInt > 12 frontInt == 0 frontInt 0 frontInt > 12 frontInt 12 isMMYY = false isMMYY false if (backInt == 0 || backInt > 12) isYYMM = false; backInt == 0 || backInt > 12 backInt == 0 backInt 0 backInt > 12 backInt 12 isYYMM = false isYYMM false if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA"); isMMYY && isYYMM isMMYY isYYMM System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA"); isMMYY System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA"); isYYMM 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);

		String s = sc.next();

		boolean isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA");

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		boolean isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("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 isMMYY = true;
		boolean isYYMM = true;

		String frontStr = s.substring(0,2);
		String backStr = s.substring(2,4);

		int frontInt = Integer.parseInt(frontStr);
		int backInt = Integer.parseInt(backStr);

		if (frontInt == 0 || frontInt > 12) isMMYY = false;
		if (backInt == 0 || backInt > 12) isYYMM = false;

		if (isMMYY && isYYMM) System.out.println("AMBIGUOUS");
		else if (isMMYY) System.out.println("MMYY");
		else if (isYYMM) System.out.println("YYMM");
		else System.out.println("NA");

	}
}