import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int abcd = sc.nextInt();
        int a = abcd / 1000;
        int b = (abcd - a * 1000) / 100;
        int c = (abcd - a * 1000 - b * 100)/10;
        int d = abcd - a * 1000 - b * 100 - c * 10;
        int ab = a * 10 + b ;
        int cd = c * 10 + d;

        if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            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 abcd = sc.nextInt();
        int a = abcd / 1000;
        int b = (abcd - a * 1000) / 100;
        int c = (abcd - a * 1000 - b * 100)/10;
        int d = abcd - a * 1000 - b * 100 - c * 10;
        int ab = a * 10 + b ;
        int cd = c * 10 + d;

        if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    }
}
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int abcd = sc.nextInt();
        int a = abcd / 1000;
        int b = (abcd - a * 1000) / 100;
        int c = (abcd - a * 1000 - b * 100)/10;
        int d = abcd - a * 1000 - b * 100 - c * 10;
        int ab = a * 10 + b ;
        int cd = c * 10 + d;

        if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    }
} main {
        Scanner sc = new Scanner(System.in);
        int abcd = sc.nextInt();
        int a = abcd / 1000;
        int b = (abcd - a * 1000) / 100;
        int c = (abcd - a * 1000 - b * 100)/10;
        int d = abcd - a * 1000 - b * 100 - c * 10;
        int ab = a * 10 + b ;
        int cd = c * 10 + d;

        if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int abcd = sc.nextInt(); abcd sc.nextInt() sc.nextInt sc int a = abcd / 1000; a abcd / 1000 abcd 1000 int b = (abcd - a * 1000) / 100; b (abcd - a * 1000) / 100 (abcd - a * 1000) abcd a * 1000 a 1000 100 int c = (abcd - a * 1000 - b * 100)/10; c (abcd - a * 1000 - b * 100)/10 (abcd - a * 1000 - b * 100) abcd - a * 1000 - b * 100 abcd a * 1000 a 1000 b * 100 b 100 10 int d = abcd - a * 1000 - b * 100 - c * 10; d abcd - a * 1000 - b * 100 - c * 10 b * 100 abcd - a * 1000 - b * 100 - c * 10 abcd a * 1000 a 1000 b * 100 b 100 c * 10 c 10 int ab = a * 10 + b ; ab a * 10 + b a * 10 a 10 b int cd = c * 10 + d; cd c * 10 + d c * 10 c 10 d if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    } 0 < ab & ab <13 0 < ab 0 ab ab <13 ab 13 {
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          } 0 < cd & cd <13 0 < cd 0 cd cd <13 cd 13 {
            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 (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    } if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        } 0 < cd & cd <13 0 < cd 0 cd cd <13 cd 13 {
            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 abcd = sc.nextInt();
        int a = abcd / 1000;
        int b = (abcd - a * 1000) / 100;
        int c = (abcd - a * 1000 - b * 100)/10;
        int d = abcd - a * 1000 - b * 100 - c * 10;
        int ab = a * 10 + b ;
        int cd = c * 10 + d;

        if (0 < ab & ab <13){
          if (0 < cd & cd <13){
            System.out.println("AMBIGUOUS");
          }else{
            System.out.println("MMYY");
          }
        } else{
          if (0 < cd & cd <13){
            System.out.println("YYMM");
        }else{
          System.out.println("NA");
        }


    }
}
}
