import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  } main {
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String yymm = sc.next(); yymm sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(yymm) sb.append sb yymm String yy = sb.substring(0,2); yy sb.substring(0,2) sb.substring sb 0 2 String mm = sb.substring(2,4); mm sb.substring(2,4) sb.substring sb 2 4 boolean isYYMM = false; isYYMM false boolean isMMYY = false; isMMYY false String answer = ""; answer "" int month = Integer.parseInt(mm); month Integer.parseInt(mm) Integer.parseInt Integer mm int year = Integer.parseInt(yy); year Integer.parseInt(yy) Integer.parseInt Integer yy if(month>=1&&month<=12){
      isYYMM = true;
    } month>=1&&month<=12 month>=1 month 1 month<=12 month 12 {
      isYYMM = true;
    } isYYMM = true isYYMM true if(year>=1&&year<=12){
      isMMYY = true;
    } year>=1&&year<=12 year>=1 year 1 year<=12 year 12 {
      isMMYY = true;
    } isMMYY = true isMMYY true if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    } !isYYMM&&!isMMYY !isYYMM isYYMM !isMMYY isMMYY {
      answer = "NA";
    } answer = "NA" answer "NA" if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    } isYYMM&&!isMMYY isYYMM !isMMYY isMMYY {
      answer = "YYMM";
    } answer = "YYMM" answer "YYMM" if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    } !isYYMM&&isMMYY !isYYMM isYYMM isMMYY {
      answer = "MMYY";
    } answer = "MMYY" answer "MMYY" {
      answer = "AMBIGUOUS";
    } answer = "AMBIGUOUS" answer "AMBIGUOUS" System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String yymm = sc.next();
    StringBuilder sb = new StringBuilder();
    sb.append(yymm);
    String yy = sb.substring(0,2);
    String mm = sb.substring(2,4);
    boolean isYYMM = false;
    boolean isMMYY = false;
    String answer = "";
    int month = Integer.parseInt(mm);
    int year = Integer.parseInt(yy);
    if(month>=1&&month<=12){
      isYYMM = true;
    }
    if(year>=1&&year<=12){
      isMMYY = true;
    }
    if(!isYYMM&&!isMMYY){
      answer = "NA";
    }else if(isYYMM&&!isMMYY){
      answer = "YYMM";
    }else if(!isYYMM&&isMMYY){
      answer = "MMYY";
    }else{
      answer = "AMBIGUOUS";
    }
    System.out.println(answer);
  }
}