import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    }

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

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    } solve {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String part1 = S.substring(0, 2); part1 S.substring(0, 2) S.substring S 0 2 String part2 = S.substring(2); part2 S.substring(2) S.substring S 2 int num1 = Integer.parseInt(part1); num1 Integer.parseInt(part1) Integer.parseInt Integer part1 int num2 = Integer.parseInt(part2); num2 Integer.parseInt(part2) Integer.parseInt Integer part2 if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        } (1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12) (1 <= num1 && num1 <= 12) 1 <= num1 1 num1 num1 <= 12 num1 12 (1 <= num2 && num2 <= 12) 1 <= num2 1 num2 num2 <= 12 num2 12 {
            System.out.print("AMBIGUOUS");
        } System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        } !(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12) !(1 <= num1 && num1 <= 12) (1 <= num1 && num1 <= 12) 1 <= num1 1 num1 num1 <= 12 num1 12 (1 <= num2 && num2 <= 12) 1 <= num2 1 num2 num2 <= 12 num2 12 {
            System.out.print("YYMM");
        } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        } (1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12) (1 <= num1 && num1 <= 12) 1 <= num1 1 num1 num1 <= 12 num1 12 !(1 <= num2 && num2 <= 12) (1 <= num2 && num2 <= 12) 1 <= num2 1 num2 num2 <= 12 num2 12 {
            System.out.print("MMYY");
        } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" {
            System.out.print("NA");
        } System.out.print("NA") System.out.print System.out System System.out "NA" // Main
    public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String part1 = S.substring(0, 2);
        String part2 = S.substring(2);

        int num1 = Integer.parseInt(part1);
        int num2 = Integer.parseInt(part2);

        if ((1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("AMBIGUOUS");
        }
        else if (!(1 <= num1 && num1 <= 12) && (1 <= num2 && num2 <= 12)) {
            System.out.print("YYMM");
        }
        else if ((1 <= num1 && num1 <= 12) && !(1 <= num2 && num2 <= 12)) {
            System.out.print("MMYY");
        }
        else {
            System.out.print("NA");
        }
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}