import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	} main {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	} try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		} catch (Exception e) {
			// TODO: handle exception
		} Exception e {
			// TODO: handle exception
		} {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String S; S int head head tail; tail S = sc.next() S sc.next() sc.next sc head = Integer.valueOf(S.substring(0, 2)) head Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 tail = Integer.valueOf(S.substring(2, 4)) tail Integer.valueOf(S.substring(2, 4)) Integer.valueOf Integer S.substring(2, 4) S.substring S 2 4 boolean headMM = inMM(head); headMM inMM(head) inMM head boolean tailMM = inMM(tail); tailMM inMM(tail) inMM tail if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} headMM && tailMM headMM tailMM {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} headMM && !tailMM headMM !tailMM tailMM {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			} !headMM && tailMM !headMM headMM tailMM {
				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 private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	} inMM {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	} if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		} 0 < value && value <= 12 0 < value 0 value value <= 12 value 12 {
			return true;
		} return true; true {
			return false;
		} return false; false int value value public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			String S;
			int head, tail;
			S = sc.next();
			head = Integer.valueOf(S.substring(0, 2));
			tail = Integer.valueOf(S.substring(2, 4));
			
			boolean headMM = inMM(head);
			boolean tailMM = inMM(tail);
			
			if (headMM && tailMM) {
				System.out.println("AMBIGUOUS");
			} else if (headMM && !tailMM) {
				System.out.println("MMYY");
			} else if (!headMM && tailMM) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	private static boolean inMM (int value) {
		if (0 < value && value <= 12) {
			return true;
		} else {
			return false;
		}
	}

}