import java.util.Scanner;

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

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    }

    static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    }
} 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();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    }

    static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));

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

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc System.out.println(solve(S)) System.out.println System.out System System.out solve(S) solve S sc.close() sc.close sc String[] args args static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    } solve {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    } boolean yymm = isMonth(S.substring(2)); yymm isMonth(S.substring(2)) isMonth S.substring(2) S.substring S 2 boolean mmyy = isMonth(S.substring(0, 2)); mmyy isMonth(S.substring(0, 2)) isMonth S.substring(0, 2) S.substring S 0 2 if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        } yymm {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            } mmyy {
                return "AMBIGUOUS";
            } return "AMBIGUOUS"; "AMBIGUOUS" {
                return "YYMM";
            } return "YYMM"; "YYMM" {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        } if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            } mmyy {
                return "MMYY";
            } return "MMYY"; "MMYY" {
                return "NA";
            } return "NA"; "NA" String S S static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    } isMonth {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    } int value = Integer.parseInt(s); value Integer.parseInt(s) Integer.parseInt Integer s return value >= 1 && value <= 12; value >= 1 && value <= 12 value >= 1 value 1 value <= 12 value 12 String s s public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    }

    static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    }

    static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    }
} Main
import java.util.Scanner;

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

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        boolean yymm = isMonth(S.substring(2));
        boolean mmyy = isMonth(S.substring(0, 2));

        if (yymm) {
            if (mmyy) {
                return "AMBIGUOUS";
            } else {
                return "YYMM";
            }
        } else {
            if (mmyy) {
                return "MMYY";
            } else {
                return "NA";
            }
        }
    }

    static boolean isMonth(String s) {
        int value = Integer.parseInt(s);

        return value >= 1 && value <= 12;
    }
}