import java.util.*;

public class Main {


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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    }
} import java.util.*; util.* java public class Main {


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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int before = Integer.parseInt(s.substring(0,2)); before Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int after = Integer.parseInt(s.substring(2)); after Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 boolean yymm yymm mmyy; mmyy yymm = mmyy = false yymm mmyy = false mmyy false if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true; 0 <= before && before < 100 && 0 < after && after < 13 0 < after 0 <= before && before < 100 && 0 < after && after < 13 0 <= before 0 before before < 100 before 100 0 < after 0 after after < 13 after 13 yymm = true yymm true if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true; 0 <= after && after < 100 && 0 < before && before < 13 0 < before 0 <= after && after < 100 && 0 < before && before < 13 0 <= after 0 after after < 100 after 100 0 < before 0 before before < 13 before 13 mmyy = true mmyy true 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" return; String[] args args public class Main {


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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    }
} public class Main {


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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    }
} Main
import java.util.*;

public class Main {


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

        String s = sc.nextLine();

        int before = Integer.parseInt(s.substring(0,2));
        int after = Integer.parseInt(s.substring(2));

        boolean yymm, mmyy;
        yymm = mmyy = false;
        if(0 <= before && before < 100 && 0 < after && after < 13) yymm = true;
        if(0 <= after && after < 100 && 0 < before && before < 13) mmyy = true;

        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");

        return;
    }
}
