import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    String line = scanner.next();
    String before = line.substring(0, 2);
    String after = line.substring(2, 4);
    if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    }
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    String line = scanner.next();
    String before = line.substring(0, 2);
    String after = line.substring(2, 4);
    if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    }
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    String line = scanner.next();
    String before = line.substring(0, 2);
    String after = line.substring(2, 4);
    if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    String line = scanner.next();
    String before = line.substring(0, 2);
    String after = line.substring(2, 4);
    if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"}; MM {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"} "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" String line = scanner.next(); line scanner.next() scanner.next scanner String before = line.substring(0, 2); before line.substring(0, 2) line.substring line 0 2 String after = line.substring(2, 4); after line.substring(2, 4) line.substring line 2 4 if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    } Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after) Arrays.asList(MM).contains(before) Arrays.asList(MM).contains Arrays.asList(MM) Arrays.asList Arrays MM before Arrays.asList(MM).contains(after) Arrays.asList(MM).contains Arrays.asList(MM) Arrays.asList Arrays MM after {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    } Arrays.asList(MM).contains(before) Arrays.asList(MM).contains Arrays.asList(MM) Arrays.asList Arrays MM before {
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    } Arrays.asList(MM).contains(after) Arrays.asList(MM).contains Arrays.asList(MM) Arrays.asList Arrays MM after {
      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
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] MM = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    String line = scanner.next();
    String before = line.substring(0, 2);
    String after = line.substring(2, 4);
    if(Arrays.asList(MM).contains(before) && Arrays.asList(MM).contains(after)){
      System.out.println("AMBIGUOUS");
    }
    else if(Arrays.asList(MM).contains(before)){
      System.out.println("MMYY");
    }
    else if(Arrays.asList(MM).contains(after)){
      System.out.println("YYMM");
    }
    else {
      System.out.println("NA");
    }
  }
}