import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} 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 int front front back; back boolean YYMMflg = false; YYMMflg false boolean MMYYflg = false; MMYYflg false front = Integer.valueOf(S.substring(0, 2)) front Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 back = Integer.valueOf(S.substring(2, 4)) back Integer.valueOf(S.substring(2, 4)) Integer.valueOf Integer S.substring(2, 4) S.substring S 2 4 if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		} 0 <= front && front <= 99 && 1 <= back && back <= 12 1 <= back 0 <= front && front <= 99 && 1 <= back && back <= 12 0 <= front 0 front front <= 99 front 99 1 <= back 1 back back <= 12 back 12 {
			YYMMflg = true;
		} YYMMflg = true YYMMflg true if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		} 0 <= back && back <= 99 && 1 <= front && front <= 12 1 <= front 0 <= back && back <= 99 && 1 <= front && front <= 12 0 <= back 0 back back <= 99 back 99 1 <= front 1 front front <= 12 front 12 {
			MMYYflg = true;
		} MMYYflg = true MMYYflg true if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} YYMMflg && MMYYflg YYMMflg MMYYflg {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} YYMMflg {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} MMYYflg {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			System.out.println("NA");
		} 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();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int front, back;
		boolean YYMMflg = false;
		boolean MMYYflg = false;

		front = Integer.valueOf(S.substring(0, 2));
		back = Integer.valueOf(S.substring(2, 4));

		// YYMM
		if (0 <= front && front <= 99 && 1 <= back && back <= 12) {
			YYMMflg = true;
		}

		// MMYY
		if (0 <= back && back <= 99 && 1 <= front && front <= 12) {
			MMYYflg = true;
		}

		if (YYMMflg && MMYYflg) {
			System.out.println("AMBIGUOUS");
		} else if (YYMMflg) {
			System.out.println("YYMM");
		} else if (MMYYflg) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
}
