import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

    if (f <= 12 && r <= 12 && f != 0 && r != 0) {
      System.out.println("AMBIGUOUS");
    } else if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } 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();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

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

} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

    if (f <= 12 && r <= 12 && f != 0 && r != 0) {
      System.out.println("AMBIGUOUS");
    } else if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } else {
      System.out.println("NA");
    }
  } main {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

    if (f <= 12 && r <= 12 && f != 0 && r != 0) {
      System.out.println("AMBIGUOUS");
    } else if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } 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 sc.close() sc.close sc int f = Integer.valueOf(S.substring(0, 2)); f Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 int r = Integer.valueOf(S.substring(S.length() - 2)); r Integer.valueOf(S.substring(S.length() - 2)) Integer.valueOf Integer S.substring(S.length() - 2) S.substring S S.length() - 2 S.length() S.length S 2 if (f <= 12 && r <= 12 && f != 0 && r != 0) {
      System.out.println("AMBIGUOUS");
    } else if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } else {
      System.out.println("NA");
    } f <= 12 && r <= 12 && f != 0 && r != 0 f != 0 f <= 12 && r <= 12 && f != 0 && r != 0 f <= 12 f 12 r <= 12 r 12 f != 0 f 0 r != 0 r 0 {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } else {
      System.out.println("NA");
    } f <= 12 && f != 0 f <= 12 f 12 f != 0 f 0 {
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } else {
      System.out.println("NA");
    } r <= 12 && r != 0 r <= 12 r 12 r != 0 r 0 {
      System.out.println("YYMM");
    } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
      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();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

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

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

    if (f <= 12 && r <= 12 && f != 0 && r != 0) {
      System.out.println("AMBIGUOUS");
    } else if (f <= 12 && f != 0) {
      System.out.println("MMYY");
    } else if (r <= 12 && r != 0) {
      System.out.println("YYMM");
    } 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();

    sc.close();

    int f = Integer.valueOf(S.substring(0, 2));
    int r = Integer.valueOf(S.substring(S.length() - 2));

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

}