import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  } main {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int s=scanner.nextInt(); s scanner.nextInt() scanner.nextInt scanner int flg1=0; flg1 0 int flg2=0; flg2 0 int sl=s/100; sl s/100 s 100 int sr=s%100; sr s%100 s 100 if(sr>0&&sr<13){
      flg1=1;
    } sr>0&&sr<13 sr>0 sr 0 sr<13 sr 13 {
      flg1=1;
    } flg1=1 flg1 1 if(sl>0&&sl<13){
      flg2=1;
    } sl>0&&sl<13 sl>0 sl 0 sl<13 sl 13 {
      flg2=1;
    } flg2=1 flg2 1 if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    } flg1==0 flg1 0 {
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    } if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY"); flg2==0 flg2 0 System.out.println("NA") System.out.println System.out System System.out "NA" System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    } if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS"); flg2==0 flg2 0 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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 scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int s=scanner.nextInt();
    int flg1=0;
    int flg2=0;

    int sl=s/100;
    int sr=s%100;
    //YYMM
    if(sr>0&&sr<13){
      flg1=1;
    }
    //MMYY
    if(sl>0&&sl<13){
      flg2=1;
    }

    if(flg1==0){
      if(flg2==0) System.out.println("NA");
      else System.out.println("MMYY");
    }
    else{
      if(flg2==0) System.out.println("YYMM");
      else System.out.println("AMBIGUOUS");
    }
    //System.out.println(ans);
  }
}
