import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int first = Integer.parseInt(s.substring(0, 2)); first Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int second = Integer.parseInt(s.substring(2)); second Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 boolean yymm = false; yymm false boolean mmyy = false; mmyy false if(second > 0 && second <= 12) {
			yymm = true;
		} second > 0 && second <= 12 second > 0 second 0 second <= 12 second 12 {
			yymm = true;
		} yymm = true yymm true if(first > 0 && first <= 12) {
			mmyy = true;
		} first > 0 && first <= 12 first > 0 first 0 first <= 12 first 12 {
			mmyy = true;
		} mmyy = true mmyy true if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} yymm && mmyy yymm mmyy {
			System.out.println("AMBIGUOUS");
		} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} yymm && !mmyy yymm !mmyy mmyy {
			System.out.println("YYMM");
		} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		} !yymm && mmyy !yymm yymm mmyy {
			System.out.println("MMYY");
		} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			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 s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
} Main
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
}
