import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
} import java.io.*; io.* java import java.util.Scanner; Scanner java.util public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
} Main private static Scanner sc; sc private static Printer pr; pr private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	} solve {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	} char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int s1 = (s[0] - '0') * 10 + s[1] - '0'; s1 (s[0] - '0') * 10 + s[1] - '0' (s[0] - '0') * 10 + s[1] (s[0] - '0') * 10 (s[0] - '0') s[0] s 0 '0' 10 s[1] s 1 '0' int s2 = (s[2] - '0') * 10 + s[3] - '0'; s2 (s[2] - '0') * 10 + s[3] - '0' (s[2] - '0') * 10 + s[3] (s[2] - '0') * 10 (s[2] - '0') s[2] s 2 '0' 10 s[3] s 3 '0' boolean f1 = s2 <= 12 && s2 > 0; f1 s2 <= 12 && s2 > 0 s2 <= 12 s2 12 s2 > 0 s2 0 boolean f2 = s1 <= 12 && s1 > 0; f2 s1 <= 12 && s1 > 0 s1 <= 12 s1 12 s1 > 0 s1 0 if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		} f1 && f2 f1 f2 {
			pr.println("AMBIGUOUS");
		} pr.println("AMBIGUOUS") pr.println pr "AMBIGUOUS" if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		} f1 {
			pr.println("YYMM");
		} pr.println("YYMM") pr.println pr "YYMM" if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		} f2 {
			pr.println("MMYY");
		} pr.println("MMYY") pr.println pr "MMYY" {
			pr.println("NA");
		} pr.println("NA") pr.println pr "NA" // ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	} main {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	} sc = new Scanner(System.in) sc new Scanner(System.in) pr = new Printer(System.out) pr new Printer(System.out) solve() solve pr.close() pr.close pr sc.close() sc.close sc String[] args args static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	} Printer Printer(OutputStream out) {
			super(out);
		} Printer {
			super(out);
		} super(out) super out OutputStream out out PrintWriter public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
} public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
} Main
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		
		int s1 = (s[0] - '0') * 10 + s[1] - '0';
		int s2 = (s[2] - '0') * 10 + s[3] - '0';

		boolean f1 = s2 <= 12 && s2 > 0;
		boolean f2 = s1 <= 12 && s1 > 0;
		if (f1 && f2) {
			pr.println("AMBIGUOUS");
		} else if (f1) {
			pr.println("YYMM");
		} else if (f2) {
			pr.println("MMYY");
		} else {
			pr.println("NA");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
