import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } 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();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } 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 begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1)); begin Integer.parseInt(s.charAt(0)+""+s.charAt(1)) Integer.parseInt Integer s.charAt(0)+""+s.charAt(1) s.charAt(0)+""+s.charAt(1) s.charAt(0) s.charAt s 0 "" s.charAt(1) s.charAt s 1 int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3)); end Integer.parseInt(s.charAt(2)+""+s.charAt(3)) Integer.parseInt Integer s.charAt(2)+""+s.charAt(3) s.charAt(2)+""+s.charAt(3) s.charAt(2) s.charAt s 2 "" s.charAt(3) s.charAt s 3 if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    } (begin > 12 || begin == 0) && (end <= 12 && end != 0) (begin > 12 || begin == 0) begin > 12 begin 12 begin == 0 begin 0 (end <= 12 && end != 0) end <= 12 end 12 end != 0 end 0 {
      System.out.println("YYMM");
    } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    } (begin <= 12 && begin !=0) && (end > 12 || end == 0) (begin <= 12 && begin !=0) begin <= 12 begin 12 begin !=0 begin 0 (end > 12 || end == 0) end > 12 end 12 end == 0 end 0 {
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    } (begin <= 12 && begin != 0) && (end <= 12 && end !=0) (begin <= 12 && begin != 0) begin <= 12 begin 12 begin != 0 begin 0 (end <= 12 && end !=0) end <= 12 end 12 end !=0 end 0 {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
      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();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } 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 begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } 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();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    }
  }
}