import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }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();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }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 String x = s.substring(0,2); x s.substring(0,2) s.substring s 0 2 String l = s.substring(2,4); l s.substring(2,4) s.substring s 2 4 int y = Integer.parseInt(x); y Integer.parseInt(x) Integer.parseInt Integer x int m = Integer.parseInt(l); m Integer.parseInt(l) Integer.parseInt Integer l if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    } 0<y && y<=12 && 0<m && m<=12 0<m 0<y && y<=12 && 0<m && m<=12 0<y 0 y y<=12 y 12 0<m 0 m m<=12 m 12 {
      System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    } 0<m && m<=12 0<m 0 m m<=12 m 12 {
      System.out.println("YYMM");
    } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    } 0<y && y<=12 0<y 0 y y<=12 y 12 {
      System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
      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();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    }
  }
} public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }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();
    String x = s.substring(0,2);
    String l = s.substring(2,4);
    int y = Integer.parseInt(x);
    int m = Integer.parseInt(l);
    // System.out.println(y + " " + m);
    if(0<y && y<=12 && 0<m && m<=12){
      System.out.println("AMBIGUOUS");
    }else if(0<m && m<=12){
      System.out.println("YYMM");
    }else if(0<y && y<=12){
      System.out.println("MMYY");
    }else{
      System.out.println("NA");
    }
  }
}
