import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  }

} import java.util.*; util.* java public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String first_s = s.substring(0,2); first_s s.substring(0,2) s.substring s 0 2 String last_s = s.substring(2,4); last_s s.substring(2,4) s.substring s 2 4 int first = Integer.parseInt(first_s); first Integer.parseInt(first_s) Integer.parseInt Integer first_s int last = Integer.parseInt(last_s); last Integer.parseInt(last_s) Integer.parseInt Integer last_s if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    } 0 < first && first <= 12 && 0 < last && last <= 12 0 < last 0 < first && first <= 12 && 0 < last && last <= 12 0 < first 0 first first <= 12 first 12 0 < last 0 last last <= 12 last 12 {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    } 0 < last && last <= 12 0 < last 0 last last <= 12 last 12 {
      System.out.println("YYMM");
    } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    } 0 < first && first <= 12 0 < first 0 first first <= 12 first 12 {
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
      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);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  }

} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  }

} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String first_s = s.substring(0,2);
    String last_s = s.substring(2,4);
    int first = Integer.parseInt(first_s);
    int last = Integer.parseInt(last_s);

    if (0 < first && first <= 12 && 0 < last && last <= 12) {
      System.out.println("AMBIGUOUS");
    } else if (0 < last && last <= 12) {
      System.out.println("YYMM");
    } else if (0 < first && first <= 12) {
      System.out.println("MMYY");
    } else {
      System.out.println("NA");
    }
  }

}
