import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int[] yOrM = new int[2]; yOrM new int[2] 2 String[] yymm = {"", ""}; yymm {"", ""} "" "" String ans = ""; ans "" yOrM[0] = S / 100 yOrM[0] yOrM 0 S / 100 S 100 yOrM[1] = S % 100 yOrM[1] yOrM 1 S % 100 S 100 for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    } int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    } {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    } if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        } yOrM[i] <= 12 && yOrM[i] >= 1 yOrM[i] <= 12 yOrM[i] yOrM i 12 yOrM[i] >= 1 yOrM[i] yOrM i 1 {
        	yymm[i] = "MM";
        } yymm[i] = "MM" yymm[i] yymm i "MM" if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        } yOrM[i] > 12 || yOrM[i] == 0 yOrM[i] > 12 yOrM[i] yOrM i 12 yOrM[i] == 0 yOrM[i] yOrM i 0 {
        	yymm[i] = "YY";
        } yymm[i] = "YY" yymm[i] yymm i "YY" {
        	yymm[i] = "NA";
        } yymm[i] = "NA" yymm[i] yymm i "NA" ans = yymm[0] + yymm[1] ans yymm[0] + yymm[1] yymm[0] yymm 0 yymm[1] yymm 1 if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    } ans.equals("MMMM") ans.equals ans "MMMM" {
    	ans = "AMBIGUOUS";
    } ans = "AMBIGUOUS" ans "AMBIGUOUS" if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    } ans.indexOf("NA") != -1 || ans.equals("YYYY") ans.indexOf("NA") != -1 ans.indexOf("NA") ans.indexOf ans "NA" -1 1 ans.equals("YYYY") ans.equals ans "YYYY" {
    	ans = "NA";
    } ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int S = sc.nextInt();
    int[] yOrM = new int[2];
    String[] yymm = {"", ""};
    String ans = "";

    yOrM[0] = S / 100;
    yOrM[1] = S % 100;

    for(int i = 0; i < 2; i++) {
    	if(yOrM[i] <= 12 && yOrM[i] >= 1) {
        	yymm[i] = "MM";
        }
        else if(yOrM[i] > 12 || yOrM[i] == 0) {
        	yymm[i] = "YY";
        } else {
        	yymm[i] = "NA";
        }
    }

    ans = yymm[0] + yymm[1];

    if(ans.equals("MMMM")) {
    	ans = "AMBIGUOUS";
    }
    else if(ans.indexOf("NA") != -1 || ans.equals("YYYY")) {
    	ans = "NA";
    }

    System.out.println(ans);
  }
}
