import java.util.*;

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

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc int tmpMonth = Integer.parseInt(S.substring(0, 2)); tmpMonth Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        } tmpMonth <= 0 || tmpMonth > 12 tmpMonth <= 0 tmpMonth 0 tmpMonth > 12 tmpMonth 12 {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } tmpMonth = Integer.parseInt(S.substring(2, 4)) tmpMonth Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            } tmpMonth <= 0 || tmpMonth > 12 tmpMonth <= 0 tmpMonth 0 tmpMonth > 12 tmpMonth 12 {
                System.out.println("NA");
            } System.out.println("NA") System.out.println System.out System System.out "NA" {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        } tmpMonth = Integer.parseInt(S.substring(2, 4)) tmpMonth Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            } tmpMonth <= 0 || tmpMonth > 12 tmpMonth <= 0 tmpMonth 0 tmpMonth > 12 tmpMonth 12 {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    }
} Main
import java.util.*;

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

        int tmpMonth = Integer.parseInt(S.substring(0, 2));
        if (tmpMonth <= 0 || tmpMonth > 12) {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("NA");
            } else {
                System.out.println("YYMM");
            }
        } else {
            tmpMonth = Integer.parseInt(S.substring(2, 4));
            if (tmpMonth <= 0 || tmpMonth > 12) {
                System.out.println("MMYY");
            } else {
                System.out.println("AMBIGUOUS");
            }
        }
    }
}
