import java.util.Scanner;

public class Main {

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

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

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

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

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    } main {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    } String s = stdIn.next(); s stdIn.next() stdIn.next stdIn char[] sc = s.toCharArray(); sc s.toCharArray() s.toCharArray s int first = (sc[0]-'0')*10 + (sc[1]-'0'); first (sc[0]-'0')*10 + (sc[1]-'0') (sc[0]-'0')*10 (sc[0]-'0') sc[0] sc 0 '0' 10 (sc[1]-'0') sc[1] sc 1 '0' int second = (sc[2]-'0')*10 + (sc[3]-'0'); second (sc[2]-'0')*10 + (sc[3]-'0') (sc[2]-'0')*10 (sc[2]-'0') sc[2] sc 2 '0' 10 (sc[3]-'0') sc[3] sc 3 '0' boolean firstIsYY = false; firstIsYY false boolean firstIsMM = false; firstIsMM false boolean secondIsYY = false; secondIsYY false boolean secondIsMM = false; secondIsMM false if(1<=first && first <=12){
            firstIsMM = true;
        } 1<=first && first <=12 1<=first 1 first first <=12 first 12 {
            firstIsMM = true;
        } firstIsMM = true firstIsMM true if(0<= first && first <=99){
            firstIsYY = true;
        } 0<= first && first <=99 0<= first 0 first first <=99 first 99 {
            firstIsYY = true;
        } firstIsYY = true firstIsYY true if(1<=second && second <=12){
            secondIsMM = true;
        } 1<=second && second <=12 1<=second 1 second second <=12 second 12 {
            secondIsMM = true;
        } secondIsMM = true secondIsMM true if(0<= second && second <=99){
            secondIsYY = true;
        } 0<= second && second <=99 0<= second 0 second second <=99 second 99 {
            secondIsYY = true;
        } secondIsYY = true secondIsYY true if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } (firstIsYY && secondIsMM) && (firstIsMM && secondIsYY) (firstIsYY && secondIsMM) firstIsYY secondIsMM (firstIsMM && secondIsYY) firstIsMM secondIsYY {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } firstIsMM && secondIsYY firstIsMM secondIsYY {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } firstIsYY && secondIsMM firstIsYY secondIsMM {
            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 {

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    }
} public class Main {

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    }
} Main
import java.util.Scanner;

public class Main {

    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args) {
        String s = stdIn.next();
        char[] sc = s.toCharArray();

        int first = (sc[0]-'0')*10 + (sc[1]-'0');
        int second = (sc[2]-'0')*10 + (sc[3]-'0');

        boolean firstIsYY = false;
        boolean firstIsMM = false;
        boolean secondIsYY = false;
        boolean secondIsMM = false;

        if(1<=first && first <=12){
            firstIsMM = true;
        }
        if(0<= first && first <=99){
            firstIsYY = true;
        }

        if(1<=second && second <=12){
            secondIsMM = true;
        }
        if(0<= second && second <=99){
            secondIsYY = true;
        }

        if((firstIsYY && secondIsMM) && (firstIsMM && secondIsYY)){
            System.out.println("AMBIGUOUS");
        }else if(firstIsMM && secondIsYY){
            System.out.println("MMYY");
        }else if(firstIsYY && secondIsMM){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }

    }
}