import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}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 buff1 = 0 buff1 0 buff2 = 0; buff2 0 buff1 = Integer.parseInt(s.substring(0,1)) buff1 Integer.parseInt(s.substring(0,1)) Integer.parseInt Integer s.substring(0,1) s.substring s 0 1 if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		} buff1>=1 buff1 1 {
			buff1 = Integer.parseInt(s.substring(0,2));
		} buff1 = Integer.parseInt(s.substring(0,2)) buff1 Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 {
			buff1 += Integer.parseInt(s.substring(1,2));
		} buff1 += Integer.parseInt(s.substring(1,2)) buff1 Integer.parseInt(s.substring(1,2)) Integer.parseInt Integer s.substring(1,2) s.substring s 1 2 buff2 = Integer.parseInt(s.substring(2,3)) buff2 Integer.parseInt(s.substring(2,3)) Integer.parseInt Integer s.substring(2,3) s.substring s 2 3 if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		} buff2>=1 buff2 1 {
			buff2 = Integer.parseInt(s.substring(2,4));
		} buff2 = Integer.parseInt(s.substring(2,4)) buff2 Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 {
			buff2 += Integer.parseInt(s.substring(3,4));
		} buff2 += Integer.parseInt(s.substring(3,4)) buff2 Integer.parseInt(s.substring(3,4)) Integer.parseInt Integer s.substring(3,4) s.substring s 3 4 if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} buff1>0 && buff1<=12 buff1>0 buff1 0 buff1<=12 buff1 12 {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		} if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			} buff2>0 && buff2<=12 buff2>0 buff2 0 buff2<=12 buff2 12 {
				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(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		} buff2>0 && buff2<=12 buff2>0 buff2 0 buff2<=12 buff2 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" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}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 buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int buff1 = 0,buff2 = 0;

		buff1 = Integer.parseInt(s.substring(0,1));
		if(buff1>=1) {
			buff1 = Integer.parseInt(s.substring(0,2));
		}else {
			buff1 += Integer.parseInt(s.substring(1,2));
		}

		buff2 = Integer.parseInt(s.substring(2,3));
		if(buff2>=1) {
			buff2 = Integer.parseInt(s.substring(2,4));
		}else {
			buff2 += Integer.parseInt(s.substring(3,4));
		}

		if(buff1>0 && buff1<=12) {
			if(buff2>0 && buff2<=12) {
				System.out.println("AMBIGUOUS");
			}else {
				System.out.println("MMYY");
			}
		}else if(buff2>0 && buff2<=12) {
			System.out.println("YYMM");
		}else {
			System.out.println("NA");
		}
	}
}


