import java.util.Scanner;

public class Main {
  private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  }
} Main private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  } isMonth {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  } int n = Integer.parseInt(ns); n Integer.parseInt(ns) Integer.parseInt Integer ns return n >= 1 && n <= 12; n >= 1 && n <= 12 n >= 1 n 1 n <= 12 n 12 String ns ns public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc sc.close() sc.close sc boolean first = isMonth(s.substring(0, 2)); first isMonth(s.substring(0, 2)) isMonth s.substring(0, 2) s.substring s 0 2 boolean second = isMonth(s.substring(2)); second isMonth(s.substring(2)) isMonth s.substring(2) s.substring s 2 String result = "NA"; result "NA" if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM"; first && second first second result = "AMBIGUOUS" result "AMBIGUOUS" if (first) result = "MMYY";
    else if (second) result = "YYMM"; first result = "MMYY" result "MMYY" if (second) result = "YYMM"; second result = "YYMM" result "YYMM" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
  private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  }
} public class Main {
  private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  }
} Main
import java.util.Scanner;

public class Main {
  private static boolean isMonth(String ns) {
    int n = Integer.parseInt(ns);
    return n >= 1 && n <= 12;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    sc.close();
    boolean first = isMonth(s.substring(0, 2));
    boolean second = isMonth(s.substring(2));
    String result = "NA";
    if (first && second) result = "AMBIGUOUS";
    else if (first) result = "MMYY";
    else if (second) result = "YYMM";
    System.out.println(result);
  }
}
