import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  }
} Main public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  } main {
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String answer=""; answer "" final String S=sc.next(); S sc.next() sc.next sc char[] s=S.toCharArray(); s S.toCharArray() S.toCharArray S char[] sA={s[0],s[1]}; sA {s[0],s[1]} s[0] s 0 s[1] s 1 char[] sB={s[2],s[3]}; sB {s[2],s[3]} s[2] s 2 s[3] s 3 int a=Integer.parseInt(String.valueOf(sA)); a Integer.parseInt(String.valueOf(sA)) Integer.parseInt Integer String.valueOf(sA) String.valueOf String sA int b=Integer.parseInt(String.valueOf(sB)); b Integer.parseInt(String.valueOf(sB)) Integer.parseInt Integer String.valueOf(sB) String.valueOf String sB if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } a==0&&b==0 a==0 a 0 b==0 b 0 {
      answer="NA";
    } answer="NA" answer "NA" if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } a==0 a 0 {
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      } b<=12 b 12 {
        answer="YYMM";
      } answer="YYMM" answer "YYMM" {
        answer="NA";
      } answer="NA" answer "NA" if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } b==0 b 0 {
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    } if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      } a<=12 a 12 {
        answer="MMYY";
      } answer="MMYY" answer "MMYY" {
        answer="NA";
      } answer="NA" answer "NA" if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } a<=12 a 12 {
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    } if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      } b<=12 b 12 {
        answer="AMBIGUOUS";
      } answer="AMBIGUOUS" answer "AMBIGUOUS" {
        answer="MMYY";
      } answer="MMYY" answer "MMYY" {
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    } if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      } b<=12 b 12 {
        answer="YYMM";
      } answer="YYMM" answer "YYMM" {
        answer="NA";
      } answer="NA" answer "NA" 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 answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String answer="";
    final String S=sc.next();
    char[] s=S.toCharArray();
    char[] sA={s[0],s[1]};
    char[] sB={s[2],s[3]};
    int a=Integer.parseInt(String.valueOf(sA));
    int b=Integer.parseInt(String.valueOf(sB));
    if(a==0&&b==0){
      answer="NA";
    }else if(a==0){
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }else if(b==0){
      if(a<=12){
        answer="MMYY";
      }else{
        answer="NA";
      }
    }else if(a<=12){
      if(b<=12){
        answer="AMBIGUOUS";
      }else{
        answer="MMYY";
      }
    }else{
      if(b<=12){
        answer="YYMM";
      }else{
        answer="NA";
      }
    }
    System.out.println(answer);
  }
}