import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  } main {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]); number1 Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]) Character.getNumericValue(c[0]) * 10 Character.getNumericValue(c[0]) Character.getNumericValue Character c[0] c 0 10 Character.getNumericValue(c[1]) Character.getNumericValue Character c[1] c 1 int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]); number2 Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]) Character.getNumericValue(c[2]) * 10 Character.getNumericValue(c[2]) Character.getNumericValue Character c[2] c 2 10 Character.getNumericValue(c[3]) Character.getNumericValue Character c[3] c 3 int count1 = 0; count1 0 int count2 = 0; count2 0 if(number1<=12 && number1>0){
      count1 += 1;
    } number1<=12 && number1>0 number1<=12 number1 12 number1>0 number1 0 {
      count1 += 1;
    } count1 += 1 count1 1 if(number2<=12 && number2>0){
      count2 += 1;
    } number2<=12 && number2>0 number2<=12 number2 12 number2>0 number2 0 {
      count2 += 1;
    } count2 += 1 count2 1 if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    } count1==1 && count2==1 count1==1 count1 1 count2==1 count2 1 {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    } count1==0 && count2==1 count1==0 count1 0 count2==1 count2 1 {
      //System.out.println(c);
      System.out.println("YYMM");
    } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    } count1==1 && count2==0 count1==1 count1 1 count2==0 count2 0 {
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(count1==0 && count2==0){
      System.out.println("NA");
    } count1==0 && count2==0 count1==0 count1 0 count2==0 count2 0 {
      System.out.println("NA");
    } 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 sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    int number1 = Character.getNumericValue(c[0]) * 10 + Character.getNumericValue(c[1]);
    int number2 = Character.getNumericValue(c[2]) * 10 + Character.getNumericValue(c[3]);

    //System.out.println(number1);
    //System.out.println(number2);

    int count1 = 0;
    int count2 = 0;

    if(number1<=12 && number1>0){
      count1 += 1;
    }
    if(number2<=12 && number2>0){
      count2 += 1;
    }
    if(count1==1 && count2==1){
      System.out.println("AMBIGUOUS");
    }
    if(count1==0 && count2==1){
      //System.out.println(c);
      System.out.println("YYMM");
    }
    if(count1==1 && count2==0){
      //System.out.println(c[2]+""+c[3]+""+c[0]+""+c[1]);
      System.out.println("MMYY");
    }
    if(count1==0 && count2==0){
      System.out.println("NA");
    }


  }
}