import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} String str = br.readLine(); str br.readLine() br.readLine br String s1 = str.substring(0, 2); s1 str.substring(0, 2) str.substring str 0 2 String s2 = str.substring(2, 4); s2 str.substring(2, 4) str.substring str 2 4 int i1 = Integer.parseInt(s1); i1 Integer.parseInt(s1) Integer.parseInt Integer s1 int i2 = Integer.parseInt(s2); i2 Integer.parseInt(s2) Integer.parseInt Integer s2 if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			} i1 < 13 && i1 != 0 i1 < 13 i1 13 i1 != 0 i1 0 {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				} i2 < 13 && i2 != 0 i2 < 13 i2 13 i2 != 0 i2 0 {
					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" {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			} if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				} i2 < 13 && i2 != 0 i2 < 13 i2 13 i2 != 0 i2 0 {
					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" br.close() br.close br String args[] args public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();

			String s1 = str.substring(0, 2);
			String s2 = str.substring(2, 4);

			int i1 = Integer.parseInt(s1);
			int i2 = Integer.parseInt(s2);

			if (i1 < 13 && i1 != 0) {
				if (i2 < 13 && i2 != 0) {
					System.out.println("AMBIGUOUS");
				} else {
					System.out.println("MMYY");
				}
			} else {
				if (i2 < 13 && i2 != 0) {
					System.out.println("YYMM");
				} else {
					System.out.println("NA");
				}
			}

			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}