using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Xml;
using static System.Console;
using static System.Math;
using static Ex;
using static Util;
using static IO_Z;
using static MyMath;

class AC {

    /*------------------------------------------------------------------*/

    void Solve() {

        string s;
        I(out s);

        var yearSet =
            Enumerable.Range(0, 100)
                      .Select(x => x.ToString("D2")).ToSet();
        var monthSet =
            Enumerable.Range(1, 12)
                      .Select(x => x.ToString("D2")).ToSet();

        var f = s.Substring(0, 2);
        var e = s.Substring(2);

        var yymm = yearSet.Contains(f) && monthSet.Contains(e);
        var mmyy = monthSet.Contains(f) && yearSet.Contains(e);

        if (yymm && mmyy) { "AMBIGUOUS".Prt(); }
        else if (yymm) { "YYMM".Prt(); }
        else if (mmyy) { "MMYY".Prt(); }
        else { "NA".Prt(); }

    }

    /*------------------------------------------------------------------*/

    void Test() {
        //--- TEST ---//
    }

    public static void Main(string[] args) => new AC().Stream();

    private void Stream() {
        SetOut(IO_Z.StreamWriter);
        /*
        var exStdIn = new http://System.IO .StreamReader("stdin.txt");
        SetIn(exStdIn);
        Test();
        */
        Solve();
        Flush();
    }

}

static class IO_Z {

    private static int Size = 1 << 12;
    private static readonly Stream Stream = OpenStandardInput();
    private static readonly byte[] Buffer = new byte[Size];
    private static int _ptr = 0, _buffLen = 0;

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static bool HasNextByte() {
        if (_ptr < _buffLen) return true;
        _ptr = 0;
        _buffLen = Stream.Read(Buffer, 0, Size);
        return _buffLen > 0;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static byte ReadByte() {
        if (HasNextByte()) return Buffer[_ptr++];
        else throw new EndOfStreamException("inputの末尾の改行がないとerror");
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static bool IsAscii(int c) => '!' <= c && c <= '~';

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static char NextChar() {
        var b = ReadByte();
        while (!IsAscii(b)) b = ReadByte();
        return (char)b;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static string Next() {
        var sb = new StringBuilder();
        for (var b = NextChar(); IsAscii(b); b = (char)ReadByte()) sb.Append(b);
        return sb.ToString();
    }

    public static string Str => Next();
    public static char Cha => NextChar();
    public static int Int => int.Parse(Next());
    public static long Long => long.Parse(Next());
    public static double Double => double.Parse(Next());

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private static void Scan <T>(ref T x) {
        if (x is int) __refvalue(__makeref(x), int) = int.Parse(Next());
        else if (x is long) __refvalue(__makeref(x), long) = long.Parse(Next());
        else if (x is double) __refvalue(__makeref(x), double) = double.Parse(Next());
        else if (x is char) __refvalue(__makeref(x), char) = NextChar();
        else __refvalue(__makeref(x), string) = Next();
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T>(out T t) {
        t = default (T);
        Scan(ref t);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T, TU>(out T t, out TU u) {
        I(out t);
        I(out u);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T, TU, TV>(out T t, out TU u, out TV v) {
        I(out t, out u);
        I(out v);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T, TU, TV, TW>(out T t, out TU u, out TV v, out TW w) {
        I(out t, out u);
        I(out v, out w);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T, TU, TV, TW, TX>(out T t, out TU u, out TV v, out TW w, out TX x) {
        I(out t, out u, out v);
        I(out w, out x);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void I <T, TU, TV, TW, TX, TY>(out T t, out TU u, out TV v, out TW w, out TX x, out TY y) {
        I(out t, out u, out v);
        I(out w, out x, out y);
    }

    public static void I <T>(out T[] a, int n) {
        a = new T[n];
        for (int i = 0; i < n; ++i) I(out a[i]);
    }

    public static void I <T, TU>(out T[] a, out TU[] b, int n) {
        a = new T[n];
        b = new TU[n];
        for (int i = 0; i < n; ++i) I(out a[i], out b[i]);
    }

    public static void I <T, TU, TV>(out T[] a, out TU[] b, out TV[] c, int n) {
        a = new T[n];
        b = new TU[n];
        c = new TV[n];
        for (var i = 0; i < n; ++i) I(out a[i], out b[i], out c[i]);
    }

    public static void I <T>(out T[,] a, int h, int w) {
        a = new T[h, w];
        for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) I(out a[i, j]);
    }

    public static readonly StreamWriter StreamWriter = new StreamWriter(OpenStandardOutput()) {
#if DEBUG
        AutoFlush = true
#else
        AutoFlush = false
#endif
    };

    public static void Flush() => Out.Flush();

    public static void Prt <T>(this T x) => WriteLine(x);

    public static void Prt <T>(this T[] xs) => xs.Iter(x => WriteLine(x));

}

static class Ex {

    public static T[] Arr <T>(params T[] xs) => xs;

    public static void Iter <T>(this IEnumerable <T> xs, Action <T> f) {
        foreach (var x in xs) f(x);
    }

    public static void Rep(this int x, Action <int> f) => REP(x, f);

    public static void RepEq(this int x, Action <int> f) => REPEQ(x, f);

    public static HashSet <T> ToSet <T>(this IEnumerable <T> xs) => new HashSet <T>(xs);

}

static class Util {

    public static T IF <T>(bool b, Func <T> fTrue, Func <T> fFalse) {
        if (b) return fTrue();
        else return fFalse();
    }

    public static T LOCAL <T>(Func <T> f) => f();

    public static IEnumerable <TResult> ZIP <T1, T2, TResult>(IEnumerable <T1> xs, IEnumerable <T2> ys, Func <T1, T2, TResult> f = null) {
        using (var e1 = xs.GetEnumerator()) using (var e2 = ys.GetEnumerator()) while (e1.MoveNext() && e2.MoveNext()) yield return f(e1.Current, e2.Current);
    }

    public static IEnumerable <Tuple <T1, T2>> ZIP <T1, T2>(IEnumerable <T1> xs, IEnumerable <T2> ys)
        => ZIP(xs, ys, (x, y) => new Tuple <T1, T2>(x, y));

    public static IEnumerable <TResult> ZIP <T1, T2, T3, TResult>(IEnumerable <T1> xs, IEnumerable <T2> ys, IEnumerable <T3> zs, Func <T1, T2, T3, TResult> f) {
        using (var e1 = xs.GetEnumerator()) using (var e2 = ys.GetEnumerator()) using (var e3 = zs.GetEnumerator()) while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext()) yield return f(e1.Current, e2.Current, e3.Current);
    }

    public static IEnumerable <Tuple <T1, T2, T3>> ZIP <T1, T2, T3>(IEnumerable <T1> xs, IEnumerable <T2> ys, IEnumerable <T3> zs) => ZIP(xs, ys, zs, (x, y, z) => new Tuple <T1, T2, T3>(x, y, z));

    public static IEnumerable <T> UNFOLD <T>(T x, Func <T, T> f, Func <T, bool> until = null) {
        if (until == null) until = (_) => true;
        yield return x;
        var newX = f(x);
        while (until(newX)) {
            yield return newX;
            newX = f(newX);
        }
    }

    public static void FOR(int a, int b, int n, Action <int> f) {
        for (var i = a; i < b; i += n) f(i);
    }

    public static void FOREQ(int a, int b, int n, Action <int> f) => FOR(a, b + 1, n, f);

    public static void FOR(int a, int b, Action <int> f) => FOR(a, b, 1, f);

    public static void FOREQ(int a, int b, Action <int> f) => FOREQ(a, b, 1, f);

    public static void REP(int a, Action <int> f) => FOR(0, a, f);

    public static void REPEQ(int a, Action <int> f) => FOR(0, a + 1, f);

    public static T MIN <T>(params T[] xs) => xs.Min();

    public static T MAX <T>(params T[] xs) => xs.Max();

    public static IEnumerable <int> RANGE(int s, int e) => Enumerable.Range(s, e - s + 1);

}

static class MyMath {

    public static int GCD(int a, int b) => (a < b) ? GCD(b, a) : b == 0 ? a : GCD(b, a % b);

    public static int GCD(params int[] xs) => xs.Aggregate(GCD);

    public static long GCD(long a, long b) => (a < b) ? GCD(b, a) : b == 0L ? a : GCD(b, a % b);

    public static long GCD(params long[] xs) => xs.Aggregate(GCD);

    public static int LCM(int a, int b) => a * (b / GCD(a, b));

    public static int LCM(params int[] xs) => xs.Aggregate(LCM);

    public static long LCM(long a, long b) => a * (b / GCD(a, b));

    public static long LCM(params long[] xs) => xs.Aggregate(LCM);

}


Measured memory_bytes: 11360