import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 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();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 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 String head = S.substring(0, 2); head S.substring(0, 2) S.substring S 0 2 String tail = S.substring(2); tail S.substring(2) S.substring S 2 int h = Integer.parseInt(head); h Integer.parseInt(head) Integer.parseInt Integer head int t = Integer.parseInt(tail); t Integer.parseInt(tail) Integer.parseInt Integer tail if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= h && h <= 12 && 1 <= t && t <= 12 1 <= t 1 <= h && h <= 12 && 1 <= t && t <= 12 1 <= h 1 h h <= 12 h 12 1 <= t 1 t t <= 12 t 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= h && h <= 12 1 <= h 1 h h <= 12 h 12 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        } 1 <= t && t <= 12 1 <= t 1 t t <= 12 t 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();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 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();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

        if (1 <= h && h <= 12 && 1 <= t && t <= 12) {
            System.out.println("AMBIGUOUS");
        } else if (1 <= h && h <= 12) {
            System.out.println("MMYY");
        } else if (1 <= t && t <= 12) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String head = S.substring(0, 2);
        String tail = S.substring(2);

        int h = Integer.parseInt(head);
        int t = Integer.parseInt(tail);

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