import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	} main {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String S = in.next(); S in.next() in.next in int front = Integer.parseInt(S.substring(0, 2)); front Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int back = Integer.parseInt(S.substring(2)); back Integer.parseInt(S.substring(2)) Integer.parseInt Integer S.substring(2) S.substring S 2 if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		} front == 0 || 13 <= front front == 0 front 0 13 <= front 13 front {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} 1 <= back && back <= 12 1 <= back 1 back back <= 12 back 12 {
				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" {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		} if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			} back == 0 || 13 <= back back == 0 back 0 13 <= back 13 back {
				System.out.println("MMYY");
			// backがMMの時
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String S = in.next();

		int front = Integer.parseInt(S.substring(0, 2));
		int back = Integer.parseInt(S.substring(2));

		// frontがYYの時
		if ( front == 0 || 13 <= front ) {

			// backがMM
			if ( 1 <= back && back <= 12 ) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		// frontがMMの時	
		} else {
			// backがYYの時
			if ( back == 0 || 13 <= back ) {
				System.out.println("MMYY");
			// backがMMの時
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
}