import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  }
  
  private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  }
  
  private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String string = sc.next(); string sc.next() sc.next sc String first = string.substring(0, 2); first string.substring(0, 2) string.substring string 0 2 String second = string.substring(2, 4); second string.substring(2, 4) string.substring string 2 4 boolean f = isMonth(first); f isMonth(first) isMonth first boolean s = isMonth(second); s isMonth(second) isMonth second String ans = null; ans null if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    } f && !s f !s s {
      ans = "MMYY";
    } ans = "MMYY" ans "MMYY" if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    } !f && s !f f s {
      ans = "YYMM";
    } ans = "YYMM" ans "YYMM" if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    } f && s f s {
      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 private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  } isMonth {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  } String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    }; month {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    } "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    } int i = 0; int i = 0; i 0 i < month.length i month.length month month.length i++ i++ i {
      if (month[i].equals(string)) {
        return true;
      }
    } {
      if (month[i].equals(string)) {
        return true;
      }
    } if (month[i].equals(string)) {
        return true;
      } month[i].equals(string) month[i].equals month[i] month i string {
        return true;
      } return true; true return false; false String string string public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  }
  
  private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  }
  
  private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String string = sc.next();

    String first = string.substring(0, 2);
    String second = string.substring(2, 4);
    boolean f = isMonth(first);
    boolean s = isMonth(second);
    
    String ans = null;
    if (f && !s) {
      ans = "MMYY";
    } else if (!f && s) {
      ans = "YYMM";
    } else if (f && s){
      ans = "AMBIGUOUS";
    } else {
      ans = "NA";
    }
    
    System.out.println(ans);
  }
  
  private static boolean isMonth(String string) {
    String[] month = {
      "01", "02", "03", "04", "05", "06", 
      "07", "08", "09", "10", "11", "12"
    };
    for (int i = 0; i < month.length; i++) {
      if (month[i].equals(string)) {
        return true;
      }
    }
    return false;
  }
}