import java.util.*;

public class Main { 
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
	  String p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } 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 p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      }
    }
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
	  String p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      }
    } main {
      Scanner sc = new Scanner(System.in);
	  String p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String p = sc.next(); p sc.next() sc.next sc int first = Integer.parseInt(p.substring(0,2)); first Integer.parseInt(p.substring(0,2)) Integer.parseInt Integer p.substring(0,2) p.substring p 0 2 int second = Integer.parseInt(p.substring(2)); second Integer.parseInt(p.substring(2)) Integer.parseInt Integer p.substring(2) p.substring p 2 boolean ff =0 < first&& first <= 12; ff 0 < first&& first <= 12 0 < first 0 first first <= 12 first 12 boolean sf = 0 < second&&second <= 12; sf 0 < second&&second <= 12 0 < second 0 second second <= 12 second 12 if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      } ff&&sf ff sf {
        System.out.println("AMBIGUOUS");
    } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      } ff&&!sf ff !sf sf {
        System.out.println("MMYY");
    } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      } !ff&&sf !ff ff sf {
        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 public class Main { 
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
	  String p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      }
    }
} public class Main { 
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
	  String p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } 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 p = sc.next();
      int first = Integer.parseInt(p.substring(0,2));
      int second = Integer.parseInt(p.substring(2));
      
      boolean ff =0 < first&& first <= 12;
      boolean sf = 0 < second&&second <= 12;
 
      if (ff&&sf) {
        System.out.println("AMBIGUOUS");
    } else if (ff&&!sf) {
        System.out.println("MMYY");
    } else if (!ff&&sf) {
        System.out.println("YYMM");
     } else {
     System.out.println("NA");
      }
    }
}