import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String result = ""; result "" String first = s.substring(0, 2); first s.substring(0, 2) s.substring s 0 2 String last = s.substring(2, 4); last s.substring(2, 4) s.substring s 2 4 int f = Integer.parseInt(first); f Integer.parseInt(first) Integer.parseInt Integer first int l = Integer.parseInt(last); l Integer.parseInt(last) Integer.parseInt Integer last if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		} 1 <= f && f <= 12 1 <= f 1 f f <= 12 f 12 {
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		} if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    } 1 <= l && l <= 12 1 <= l 1 l l <= 12 l 12 {
		        result = "AMBIGUOUS";
		    } result = "AMBIGUOUS" result "AMBIGUOUS" {
		        result = "MMYY";
		    } result = "MMYY" result "MMYY" {
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		} if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    } 1 <= l && l <= 12 1 <= l 1 l l <= 12 l 12 {
		        result = "YYMM";
		    } result = "YYMM" result "YYMM" {
		        result = "NA";
		    } result = "NA" result "NA" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "";
		
		String first = s.substring(0, 2);
		String last = s.substring(2, 4);
		int f = Integer.parseInt(first);
		int l = Integer.parseInt(last);
		
		if(1 <= f && f <= 12){
		    if(1 <= l && l <= 12){
		        result = "AMBIGUOUS";
		    }else{
		        result = "MMYY";
		    }
		}else{
		    if(1 <= l && l <= 12){
		        result = "YYMM";
		    }else{
		        result = "NA";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}