import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  } main {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String arg = scan.next(); arg scan.next() scan.next scan int p = Integer.parseInt(arg.substring(0, 2)); p Integer.parseInt(arg.substring(0, 2)) Integer.parseInt Integer arg.substring(0, 2) arg.substring arg 0 2 int s = Integer.parseInt(arg.substring(2)); s Integer.parseInt(arg.substring(2)) Integer.parseInt Integer arg.substring(2) arg.substring arg 2 boolean pim = 1 <= p && p <= 12; pim 1 <= p && p <= 12 1 <= p 1 p p <= 12 p 12 boolean sim = 1 <= s && s <= 12; sim 1 <= s && s <= 12 1 <= s 1 s s <= 12 s 12 System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA") System.out.println System.out System System.out pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA" pim sim ? "AMBIGUOUS" : "MMYY" sim "AMBIGUOUS" "MMYY" sim ? "YYMM" : "NA" sim "YYMM" "NA" String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String arg = scan.next();
    int p = Integer.parseInt(arg.substring(0, 2));
    int s = Integer.parseInt(arg.substring(2));
    boolean pim = 1 <= p && p <= 12;
    boolean sim = 1 <= s && s <= 12;
    System.out.println(pim ? sim ? "AMBIGUOUS" : "MMYY" : sim ? "YYMM" : "NA");
  }
}