import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	}

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

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	}

} Main public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	} main {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String inputS = sc.next(); inputS sc.next() sc.next sc String[] S = inputS.split(""); S inputS.split("") inputS.split inputS "" sc.close() sc.close sc String B = S[0]+S[1]; B S[0]+S[1] S[0] S 0 S[1] S 1 int b1 = Integer.parseInt(B); b1 Integer.parseInt(B) Integer.parseInt Integer B B = S[2]+S[3] B S[2]+S[3] S[2] S 2 S[3] S 3 int b2 = Integer.parseInt(B); b2 Integer.parseInt(B) Integer.parseInt Integer B boolean IsYYMM = true; IsYYMM true boolean IsMMYY = true; IsMMYY true if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		} !(1 <= b1 && b1 <= 12) (1 <= b1 && b1 <= 12) 1 <= b1 1 b1 b1 <= 12 b1 12 {
			IsMMYY = false;
		} IsMMYY = false IsMMYY false if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		} !(1 <= b2 && b2 <= 12) (1 <= b2 && b2 <= 12) 1 <= b2 1 b2 b2 <= 12 b2 12 {
			IsYYMM = false;
		} IsYYMM = false IsYYMM false if(b1 == 0) {
			IsMMYY = false;
		} b1 == 0 b1 0 {
			IsMMYY = false;
		} IsMMYY = false IsMMYY false if(b2 == 0) {
			IsYYMM = false;
		} b2 == 0 b2 0 {
			IsYYMM = false;
		} IsYYMM = false IsYYMM false if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		} IsYYMM && IsMMYY IsYYMM IsMMYY {
			System.out.print("AMBIGUOUS");
		} System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		} IsYYMM {
			System.out.print("YYMM");
		} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		} IsMMYY {
			System.out.print("MMYY");
		} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" {
			System.out.print("NA");
		} System.out.print("NA") System.out.print System.out System System.out "NA" String[] args args public class Main {

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	}

} public class Main {

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		String inputS = sc.next();
		String[] S = inputS.split("");
		sc.close();

		//Logic
		String B = S[0]+S[1];
		int b1 = Integer.parseInt(B);

		B = S[2]+S[3];
		int b2 = Integer.parseInt(B);

		boolean IsYYMM = true;
		boolean IsMMYY = true;

		if(!(1 <= b1 && b1 <= 12)) {
			IsMMYY = false;
		}

		if(!(1 <= b2 && b2 <= 12)) {
			IsYYMM = false;
		}

		if(b1 == 0) {
			IsMMYY = false;
		}

		if(b2 == 0) {
			IsYYMM = false;
		}

		if(IsYYMM && IsMMYY) {
			System.out.print("AMBIGUOUS");
		}else if(IsYYMM) {
			System.out.print("YYMM");
		}else if(IsMMYY) {
			System.out.print("MMYY");
		}else {
			System.out.print("NA");
		}

	}

}
