import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }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 former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=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();
    String former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=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 String former = s.substring(0,2); former s.substring(0,2) s.substring s 0 2 String latter = s.substring(2,4); latter s.substring(2,4) s.substring s 2 4 int formerInt = Integer.parseInt(former); formerInt Integer.parseInt(former) Integer.parseInt Integer former int latterInt = Integer.parseInt(latter); latterInt Integer.parseInt(latter) Integer.parseInt Integer latter if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    } formerInt == 0 formerInt 0 {
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    } if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      } latterInt == 0 || latterInt > 12 latterInt == 0 latterInt 0 latterInt > 12 latterInt 12 {
        System.out.println("NA");
      } System.out.println("NA") System.out.println System.out System System.out "NA" {
        System.out.println("YYMM");
      } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    } formerInt >0 && formerInt <= 12 formerInt >0 formerInt 0 formerInt <= 12 formerInt 12 {
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    } if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      } latterInt == 0 || latterInt > 12 latterInt == 0 latterInt 0 latterInt > 12 latterInt 12 {
        System.out.println("MMYY");
      } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
        System.out.println("AMBIGUOUS");
      } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(formerInt >12){
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    } formerInt >12 formerInt 12 {
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    } if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      } 0<latterInt && latterInt<=12 0<latterInt 0 latterInt latterInt<=12 latterInt 12 {
        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 public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=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();
    String former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }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 former = s.substring(0,2);
    String latter = s.substring(2,4);
    int formerInt = Integer.parseInt(former);
    int latterInt = Integer.parseInt(latter);
    
    if(formerInt == 0){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("NA");
      } else {
        System.out.println("YYMM");
      }
    }
    
    if(formerInt >0 && formerInt <= 12){
      if(latterInt == 0 || latterInt > 12){
        System.out.println("MMYY");
      }else{
        System.out.println("AMBIGUOUS");
      }
    }
    
    if(formerInt >12){
      if(0<latterInt && latterInt<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  }
}