import java.util.*;

public class Main{
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  }
} Main public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  } main {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = a/100; b a/100 a 100 int c = a - b*100; c a - b*100 a b*100 b 100 if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  } b > 12 || b < 1 b > 12 b 12 b < 1 b 1 {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  } if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  } c > 12 || c < 1 c > 12 c 12 c < 1 c 1 {
			  System.out.println("NA");
		  } System.out.println("NA") System.out.println System.out System System.out "NA" {
			  System.out.println("YYMM");
		  } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  } b < 13 && b > 0 b < 13 b 13 b > 0 b 0 {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  } if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  } c > 12 || c < 1 c > 12 c 12 c < 1 c 1 {
			  System.out.println("MMYY");
		  } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			  System.out.println("AMBIGUOUS");
		  } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main{
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  }
} public class Main{
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = a/100;
	  int c = a - b*100;
	  if(b > 12 || b < 1) {
		  if(c > 12 || c < 1) {
			  System.out.println("NA");
		  }
		  else {
			  System.out.println("YYMM");
		  }
	  }
	  else if(b < 13 && b > 0) {
		  if(c > 12 || c < 1) {
			  System.out.println("MMYY");
		  }
		  else {
			  System.out.println("AMBIGUOUS");
		  }
	  }
  }
}