import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
} import java.util.*; util.* java import java.math.*; math.* java import java.io.*; io.* java public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    } main {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    } String s = sc.next(); s sc.next() sc.next sc int a = Integer.parseInt(s.substring(0,2)); a Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int b = Integer.parseInt(s.substring(2,4)); b Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 boolean yymm = b <= 12 && b >= 1; yymm b <= 12 && b >= 1 b <= 12 b 12 b >= 1 b 1 boolean mmyy = a <= 12 && a >= 1; mmyy a <= 12 && a >= 1 a <= 12 a 12 a >= 1 a 1 if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA"); yymm && mmyy yymm mmyy System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA"); yymm System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(mmyy) System.out.println("MMYY");
        else System.out.println("NA"); mmyy System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.out.println("NA") System.out.println System.out System System.out "NA" String args[] args public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
} Main
import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
}