import java.util.Scanner;

public class Main {

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

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 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) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

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

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

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

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int format = Integer.parseInt(S); format Integer.parseInt(S) Integer.parseInt Integer S int left = format / 100; left format / 100 format 100 int right = format % 100; right format % 100 format 100 if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } left >= 1 && left <= 12 left >= 1 left 1 left <= 12 left 12 {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            } right >= 1 && right <= 12 right >= 1 right 1 right <= 12 right 12 {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } right >= 1 && right <= 12 right >= 1 right 1 right <= 12 right 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) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

    }
} public class Main {

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

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

    }
} Main
import java.util.Scanner;

public class Main {

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

        String S = sc.next();
        int format = Integer.parseInt(S);
        int left = format / 100;
        int right = format % 100;

        if (left >= 1 && left <= 12) {
            if (right >= 1 && right <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else if (right >= 1 && right <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }

    }
}
