import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) 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 str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA");
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA");
    } main {
    	Scanner sc = new Scanner(System.in);
      String str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String s1 = str.substring(0,2); s1 str.substring(0,2) str.substring str 0 2 String s2 = str.substring(2,4); s2 str.substring(2,4) str.substring str 2 4 int x = Integer.parseInt(s1); x Integer.parseInt(s1) Integer.parseInt Integer s1 int y = Integer.parseInt(s2); y Integer.parseInt(s2) Integer.parseInt Integer s2 if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA"); x>=1 && x<=12 && y>=1 && y<=12 y>=1 x>=1 && x<=12 && y>=1 && y<=12 x>=1 x 1 x<=12 x 12 y>=1 y 1 y<=12 y 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA"); x>=1 && x<=12 x>=1 x 1 x<=12 x 12 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA"); y>=1 && y<=12 y>=1 y 1 y<=12 y 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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 str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) 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 str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) 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 str = sc.next();
      String s1 = str.substring(0,2);
      String s2 = str.substring(2,4);
      int x = Integer.parseInt(s1);
      int y = Integer.parseInt(s2);
      if(x>=1 && x<=12 && y>=1 && y<=12) System.out.println("AMBIGUOUS");
      else if(x>=1 && x<=12) System.out.println("MMYY");
      else if(y>=1 && y<=12) System.out.println("YYMM");
      else System.out.println("NA");
    }
}
