import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) 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 stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

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

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int a = n % 100; a n % 100 n 100 int b = (n - a) / 100; b (n - a) / 100 (n - a) n a 100 boolean um = false; um false boolean sm = false; sm false if(0 < a && a < 13) um = true; 0 < a && a < 13 0 < a 0 a a < 13 a 13 um = true um true if(0 < b && b < 13) sm = true; 0 < b && b < 13 0 < b 0 b b < 13 b 13 sm = true sm true if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA"); um && sm um sm System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA"); um System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(sm) System.out.println("MMYY");
		else System.out.println("NA"); sm System.out.println("MMYY") System.out.println System.out System System.out "MMYY" 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 stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

	}
} public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		int a = n % 100;
		int b = (n - a) / 100;

		boolean um = false;
		boolean sm = false;

		if(0 < a && a < 13) um = true;
		if(0 < b && b < 13) sm = true;

		if(um && sm) System.out.println("AMBIGUOUS");
		else if(um) System.out.println("YYMM");
		else if(sm) System.out.println("MMYY");
		else System.out.println("NA");

	}
}