import java.util.Scanner;

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

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

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

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int[] b = new int[4]; b new int[4] 4 b[0] = a/1000 b[0] b 0 a/1000 a 1000 b[1] = (a/100)%10 b[1] b 1 (a/100)%10 (a/100) a 100 10 b[2] = (a/10)%10 b[2] b 2 (a/10)%10 (a/10) a 10 10 b[3] = a%10 b[3] b 3 a%10 a 10 int TH = b[0]*10 + b[1]; TH b[0]*10 + b[1] b[0]*10 b[0] b 0 10 b[1] b 1 int TO = b[2]*10 + b[3]; TO b[2]*10 + b[3] b[2]*10 b[2] b 2 10 b[3] b 3 if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		} TH > 12 TH 12 {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		} if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");} TO > 12 TO 12 System.out.print("NA") System.out.print System.out System System.out "NA" if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");} TO <=12 TO 12 {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");} if(TO==0) {System.out.print("NA");
				System.exit(0);} TO==0 TO 0 {System.out.print("NA");
				System.exit(0);} System.out.print("NA") System.out.print System.out System System.out "NA" System.exit(0) System.exit System 0 System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		} TH <=12 TH 12 {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		} if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			} TH==0 TH 0 {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			} if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA"); TO > 12 TO 12 System.out.print("NA") System.out.print System.out System System.out "NA" if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA"); TO<=12 && TO>0 TO<=12 TO 12 TO>0 TO 0 System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if(TO==0) System.out.print("NA"); TO==0 TO 0 System.out.print("NA") System.out.print System.out System System.out "NA" {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			} if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY"); TO > 12 TO 12 System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY"); TO<=12 && TO>0 TO<=12 TO 12 TO>0 TO 0 System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" if(TO==0) System.out.print("MMYY"); TO==0 TO 0 System.out.print("MMYY") System.out.print System.out System System.out "MMYY" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

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

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

} Main
import java.util.Scanner;

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

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

}