import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    sc.close();
    int L = S/100;
    int R = S%100;
    if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    sc.close();
    int L = S/100;
    int R = S%100;
    if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    sc.close();
    int L = S/100;
    int R = S%100;
    if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    sc.close();
    int L = S/100;
    int R = S%100;
    if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc sc.close() sc.close sc int L = S/100; L S/100 S 100 int R = S%100; R S%100 S 100 if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    } L>=1 && L<=12 L>=1 L 1 L<=12 L 12 {
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    } if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      } R>=1 && R<=12 R>=1 R 1 R<=12 R 12 {
        System.out.println("AMBIGUOUS");
      } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
        System.out.println("MMYY");
      } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    } if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      } R>=1 && R<=12 R>=1 R 1 R<=12 R 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
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    sc.close();
    int L = S/100;
    int R = S%100;
    if (L>=1 && L<=12){
      if (R>=1 && R<=12){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if (R>=1 && R<=12){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  }
}