import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 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) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        }} Main public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        } main {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str1 = scan.nextLine(); str1 scan.nextLine() scan.nextLine scan scan.close() scan.close scan String mae = str1.substring(0,2); mae str1.substring(0,2) str1.substring str1 0 2 String ushiro = str1.substring(2,4); ushiro str1.substring(2,4) str1.substring str1 2 4 int maei = Integer.parseInt(mae); maei Integer.parseInt(mae) Integer.parseInt Integer mae int ushiroi = Integer.parseInt(ushiro); ushiroi Integer.parseInt(ushiro) Integer.parseInt Integer ushiro if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } (1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12) (1 <= maei && maei <= 12) 1 <= maei 1 maei maei <= 12 maei 12 (1 <= ushiroi && ushiroi <= 12) 1 <= ushiroi 1 ushiroi ushiroi <= 12 ushiroi 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } 1 <= maei && maei <= 12 1 <= maei 1 maei maei <= 12 maei 12 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } 1 <= ushiroi && ushiroi <= 12 1 <= ushiroi 1 ushiroi ushiroi <= 12 ushiroi 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) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        }} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        }} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        scan.close();
        String mae = str1.substring(0,2);
        String ushiro = str1.substring(2,4);
        int maei = Integer.parseInt(mae);
        int ushiroi = Integer.parseInt(ushiro);
        if((1 <= maei && maei <= 12) && (1 <= ushiroi && ushiroi <= 12)){
            System.out.println("AMBIGUOUS");
        }else if(1 <= maei && maei <= 12){
            System.out.println("MMYY");
        }else if(1 <= ushiroi && ushiroi <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }



        }}