import java.util.*;

class Main {
    public static void main(final String[] args) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    }
} import java.util.*; util.* java class Main {
    public static void main(final String[] args) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    }
} Main public static void main(final String[] args) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    } main {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int f = s/100; f s/100 s 100 int b = s%100; b s%100 s 100 if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      } f == 0 && b == 0 f == 0 f 0 b == 0 b 0 {
        System.out.println("NA");
        System.exit(0);
      } System.out.println("NA") System.out.println System.out System System.out "NA" System.exit(0) System.exit System 0 if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      } (f >= 1 && f <= 12) && (b >= 1 && b <= 12) (f >= 1 && f <= 12) f >= 1 f 1 f <= 12 f 12 (b >= 1 && b <= 12) b >= 1 b 1 b <= 12 b 12 {
        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 (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      } f >= 1 && f <= 12 f >= 1 f 1 f <= 12 f 12 {
        System.out.println("MMYY");
        System.exit(0);
      } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.exit(0) System.exit System 0 {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      } if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        } b >= 1 && b <= 12 b >= 1 b 1 b <= 12 b 12 {
          System.out.println("YYMM");
          System.exit(0);
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.exit(0) System.exit System 0 System.out.println("NA") System.out.println System.out System System.out "NA" System.exit(0) System.exit System 0 final String[] args args
import java.util.*;

class Main {
    public static void main(final String[] args) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    }
}