import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	} main {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int S = stdIn.nextInt(); S stdIn.nextInt() stdIn.nextInt stdIn int a[] = new int[4]; a new int[4] 4 for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		} int i = 3; int i = 3; i 3 i >= 0 i 0 i-- i-- i {
			a[i] = S%10;
			S = S/10;
		} {
			a[i] = S%10;
			S = S/10;
		} a[i] = S%10 a[i] a i S%10 S 10 S = S/10 S S/10 S 10 if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		} a[0] == 0 && a[1] >=1 a[0] == 0 a[0] a 0 0 a[1] >=1 a[1] a 1 1 {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		} if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			} a[2] == 0 && a[3] >= 1 a[2] == 0 a[2] a 2 0 a[3] >= 1 a[3] a 3 1 {
				System.out.println("AMBIGUOUS");
			} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			} a[2] == 1 a[2] a 2 1 {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			} if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				} a[3] <= 2 a[3] a 3 2 {
					System.out.println("AMBIGUOUS");
				} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
					System.out.println("MMYY");
				} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
				System.out.println("MMYY");
			} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		} a[0] == 1 a[0] a 0 1 {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		} if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			} a[1] <= 2 a[1] a 1 2 {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			} if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				} a[2] == 0 && a[3] >= 1 a[2] == 0 a[2] a 2 0 a[3] >= 1 a[3] a 3 1 {
					System.out.println("AMBIGUOUS");
				} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				} a[2] == 1 a[2] a 2 1 {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				} if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					} a[3] <= 2 a[3] a 3 2 {
						System.out.println("AMBIGUOUS");
					} System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
						System.out.println("MMYY");
					} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
					System.out.println("MMYY");
				} System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			} if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				} a[2] == 0 && a[3] >= 1 a[2] == 0 a[2] a 2 0 a[3] >= 1 a[3] a 3 1 {
					System.out.println("YYMM");
				} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				} a[2] == 1 a[2] a 2 1 {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				} if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					} a[3] <= 2 a[3] a 3 2 {
						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" {
					System.out.println("NA");
				} System.out.println("NA") System.out.println System.out System System.out "NA" {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		} if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			} a[2] == 0 && a[3] >= 1 a[2] == 0 a[2] a 2 0 a[3] >= 1 a[3] a 3 1 {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			} a[2] == 1 a[2] a 2 1 {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			} if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				} a[3] <= 2 a[3] a 3 2 {
					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" {
				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 stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int S = stdIn.nextInt();
		int a[] = new int[4];
		for(int i = 3; i >= 0; i--) {
			a[i] = S%10;
			S = S/10;
		}
		
		if(a[0] == 0 && a[1] >=1) {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("AMBIGUOUS");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("AMBIGUOUS");
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				System.out.println("MMYY");
			}
		}
		else if (a[0] == 1) {
			if(a[1] <= 2) {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("AMBIGUOUS");
				}
				else if(a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("AMBIGUOUS");
					}
					else {
						System.out.println("MMYY");
					}
				}
				else {
					System.out.println("MMYY");
				}
			}
			else {
				if(a[2] == 0 && a[3] >= 1) {
					System.out.println("YYMM");
				}
				else if (a[2] == 1) {
					if(a[3] <= 2) {
						System.out.println("YYMM");
					}
					else {
						System.out.println("NA");
					}
				}
				else {
					System.out.println("NA");
				}
			}
		}
		else {
			if(a[2] == 0 && a[3] >= 1) {
				System.out.println("YYMM");
			}
			else if(a[2] == 1) {
				if(a[3] <= 2) {
					System.out.println("YYMM");
				}
				else {
					System.out.println("NA");
				}
			}
			else {
				System.out.println("NA");
			}
		}

	}

}