import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	}

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

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	} main {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String s = sc.next(); s sc.next() sc.next sc sc.close() sc.close sc final String s1 = s.substring(0, 2); s1 s.substring(0, 2) s.substring s 0 2 final String s2 = s.substring(2); s2 s.substring(2) s.substring s 2 final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12")); mmList new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12")) if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		} !mmList.contains(s1) && !mmList.contains(s2) !mmList.contains(s1) mmList.contains(s1) mmList.contains mmList s1 !mmList.contains(s2) mmList.contains(s2) mmList.contains mmList s2 {
			System.out.print("NA");
			return;
		} System.out.print("NA") System.out.print System.out System System.out "NA" return; if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		} mmList.contains(s1) && mmList.contains(s2) mmList.contains(s1) mmList.contains mmList s1 mmList.contains(s2) mmList.contains mmList s2 {
			System.out.print("AMBIGUOUS");
			return;
		} System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" return; if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		} mmList.contains(s2) mmList.contains mmList s2 {
			System.out.print("YYMM");
			return;
		} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" return; if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		} mmList.contains(s1) mmList.contains mmList s1 {
			System.out.print("MMYY");
			return;
		} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	}

} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		final String s = sc.next();

		sc.close();

		final String s1 = s.substring(0, 2);
		final String s2 = s.substring(2);

		final List<String> mmList = new ArrayList<>(Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));

		if (!mmList.contains(s1) && !mmList.contains(s2)) {
			System.out.print("NA");
			return;
		}
		if (mmList.contains(s1) && mmList.contains(s2)) {
			System.out.print("AMBIGUOUS");
			return;
		}
		if (mmList.contains(s2)) {
			System.out.print("YYMM");
			return;
		}
		if (mmList.contains(s1)) {
			System.out.print("MMYY");
			return;
		}

	}

}
