import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

     String s = sc.next();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       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();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       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();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       System.out.println("MMYY");
     }else{
       System.out.println("NA");
     }


      } main {
      Scanner sc = new Scanner(System.in);

     String s = sc.next();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       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 char[] c = new char[4]; c new char[4] 4 int[] a = new int[4]; a new int[4] 4 for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     } int i = 0; int i = 0; i 0 i<4 i 4 i++ i++ i {
       c[i] = s.charAt(i);
     } {
       c[i] = s.charAt(i);
     } c[i] = s.charAt(i) c[i] c i s.charAt(i) s.charAt s i for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     } int i = 0; int i = 0; i 0 i<4 i 4 i++ i++ i {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     } {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     } String sn = String.valueOf(c[i]); sn String.valueOf(c[i]) String.valueOf String c[i] c i a[i] =  Integer.parseInt(sn) a[i] a i Integer.parseInt(sn) Integer.parseInt Integer sn if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     } a[0]*10+a[1]<=12&&a[0]*10+a[1]>0 a[0]*10+a[1]<=12 a[0]*10+a[1] a[0]*10 a[0] a 0 10 a[1] a 1 12 a[0]*10+a[1]>0 a[0]*10+a[1] a[0]*10 a[0] a 0 10 a[1] a 1 0 {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     } if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       } a[2]*10+a[3]<=12&&a[2]*10+a[3]>0 a[2]*10+a[3]<=12 a[2]*10+a[3] a[2]*10 a[2] a 2 10 a[3] a 3 12 a[2]*10+a[3]>0 a[2]*10+a[3] a[2]*10 a[2] a 2 10 a[3] a 3 0 {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" System.exit(0) System.exit System 0 if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       System.out.println("MMYY");
     }else{
       System.out.println("NA");
     } a[2]*10+a[3]<=12&&a[2]*10+a[3]>0 a[2]*10+a[3]<=12 a[2]*10+a[3] a[2]*10 a[2] a 2 10 a[3] a 3 12 a[2]*10+a[3]>0 a[2]*10+a[3] a[2]*10 a[2] a 2 10 a[3] a 3 0 {
        System.out.println("YYMM");
     } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       System.out.println("MMYY");
     }else{
       System.out.println("NA");
     } a[0]*10+a[1]<=12&&a[0]*10+a[1]>0 a[0]*10+a[1]<=12 a[0]*10+a[1] a[0]*10 a[0] a 0 10 a[1] a 1 12 a[0]*10+a[1]>0 a[0]*10+a[1] a[0]*10 a[0] a 0 10 a[1] a 1 0 {
       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();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       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();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       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();
     char[] c = new char[4];
     int[] a = new int[4];

     for (int i = 0;i<4 ;i++ ) {
       c[i] = s.charAt(i);
     }

     for (int i = 0;i<4 ;i++ ) {
       String sn = String.valueOf(c[i]);
       a[i] =  Integer.parseInt(sn);
     }

     if (a[0]*10+a[1]<=12&&a[0]*10+a[1]>0) {
       if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
         System.out.println("AMBIGUOUS");
         System.exit(0);
       }
     }

     if (a[2]*10+a[3]<=12&&a[2]*10+a[3]>0) {
        System.out.println("YYMM");
     }else if(a[0]*10+a[1]<=12&&a[0]*10+a[1]>0){
       System.out.println("MMYY");
     }else{
       System.out.println("NA");
     }


      }
    }
