import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      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();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      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 int prefix = Integer.parseInt(s.substring(0, 2)); prefix Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int suffix = Integer.parseInt(s.substring(2, 4)); suffix Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12 suffix >= 1 prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12 prefix >= 1 prefix 1 prefix <= 12 prefix 12 suffix >= 1 suffix 1 suffix <= 12 suffix 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); prefix >= 1 && prefix <= 12 prefix >= 1 prefix 1 prefix <= 12 prefix 12 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); suffix >= 1 && suffix <= 12 suffix >= 1 suffix 1 suffix <= 12 suffix 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      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();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int prefix = Integer.parseInt(s.substring(0, 2));
    int suffix = Integer.parseInt(s.substring(2, 4));

    if (prefix >= 1 && prefix <= 12 && suffix >= 1 && suffix <= 12)
      System.out.println("AMBIGUOUS");
    else if (prefix >= 1 && prefix <= 12)
      System.out.println("MMYY");
    else if (suffix >= 1 && suffix <= 12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
}