import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  }
} Main public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  } main {
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  } Scanner cs = new Scanner(System.in); cs new Scanner(System.in) String s = cs.nextLine(); s cs.nextLine() cs.nextLine cs int a a b; b a = Integer.parseInt(s.substring(0,2)) a Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 b = Integer.parseInt(s.substring(2,4)) b Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 String ans; ans if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    } 0<a&&a<13&&(b==0||b>12) 0<a&&a<13&&(b==0||b>12) 0<a 0 a a<13 a 13 (b==0||b>12) b==0 b 0 b>12 b 12 {
      ans = "MMYY";
    } ans = "MMYY" ans "MMYY" if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    } (0<b&&b<13&&(a==0||a>12)) 0<b&&b<13&&(a==0||a>12) 0<b 0 b b<13 b 13 (a==0||a>12) a==0 a 0 a>12 a 12 {
      ans = "YYMM";
    } ans = "YYMM" ans "YYMM" if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    } 0<a&&a<13&&0<b&&b<13 0<b 0<a&&a<13&&0<b&&b<13 0<a 0 a a<13 a 13 0<b 0 b b<13 b 13 {
      ans = "AMBIGUOUS";
    } ans = "AMBIGUOUS" ans "AMBIGUOUS" {
      ans = "NA";
    } ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  }
} public class Main{
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
	String s = cs.nextLine();
    int a,b;

    a = Integer.parseInt(s.substring(0,2));
    b = Integer.parseInt(s.substring(2,4));
    String ans;
    if(0<a&&a<13&&(b==0||b>12)){
      ans = "MMYY";
    }else if((0<b&&b<13&&(a==0||a>12))){
      ans = "YYMM";
    }else if(0<a&&a<13&&0<b&&b<13){
      ans = "AMBIGUOUS";
    }else{
      ans = "NA";
    }
    System.out.println(ans);

    
  }
}