
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 class Main {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        int a;
        int b;
        public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java class Main {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        int a;
        int b;
        public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        }
    }
} Main static InputReader sc=new InputReader(System.in); sc new InputReader(System.in) static PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    } main {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    } solver s=new solver(); s new solver() int t=1; t 1 while(t>0)
        {
            s.solve();
            t--;
        } t>0 t 0 {
            s.solve();
            t--;
        } s.solve() s.solve s t-- t String[] args args static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    } InputReader public BufferedReader br; br public StringTokenizer token; token public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        } InputReader {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        } br=new BufferedReader(new InputStreamReader(stream),32768) br new BufferedReader(new InputStreamReader(stream),32768) token=null token null InputStream stream stream public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        } next {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        } while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            } token==null || !token.hasMoreTokens() token==null token null !token.hasMoreTokens() token.hasMoreTokens() token.hasMoreTokens token {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            } try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                } catch(IOException e)
                {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    token=new StringTokenizer(br.readLine());
                } token=new StringTokenizer(br.readLine()) token new StringTokenizer(br.readLine()) return token.nextToken(); token.nextToken() token.nextToken token public int nextInt()
        {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong()
        {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble()
        {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    } card long a; a int cnt; cnt int i; i public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        } card {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        } this.a=a this.a this this.a a this.cnt=cnt this.cnt this this.cnt cnt this.i=i this.i this this.i i long a a int cnt cnt int i i static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        }
    } ascend public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        } compare {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        } if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a; o1.b!=o2.b o1.b o1 o1.b o2.b o2 o2.b return (int)(o1.b-o2.b); (int)(o1.b-o2.b) o1.b o1 o1.b o2.b o2 o2.b return o1.a-o2.a; o1.a-o2.a o1.a o1 o1.a o2.a o2 o2.a pair o1 o1 pair o2 o2 Comparator static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    } extra static boolean v[]=new boolean[100001]; v new boolean[100001] 100001 static List<Integer> l=new ArrayList<>(); l new ArrayList<>() static int t; t static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        } shuffle {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        } List<Long> l=new ArrayList<>(); l new ArrayList<>() for(int i=0;i<a.length;i++)
                l.add(a[i]); int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i l.add(a[i]); l.add(a[i]) l.add l a[i] a i Collections.shuffle(l) Collections.shuffle Collections l for(int i=0;i<a.length;i++)
                a[i]=l.get(i); int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i a[i]=l.get(i); a[i]=l.get(i) a[i] a i l.get(i) l.get l i long a[] a static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        } gcd {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        } if(b==0)
                return a;
            else
                return gcd(b,a%b); b==0 b 0 return a; a return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b long a a long b b static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        } valid {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        } if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false; i>=0 && i<r && j>=0 && j<c j>=0 i>=0 && i<r && j>=0 && j<c i>=0 i 0 i<r i r j>=0 j 0 j<c j c return true; true return false; false int i i int j j int r r int c c static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        } seive {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        } for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            } int i=2; int i=2; i 2 i<100001 i 100001 i++ i++ i {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            } {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            } if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                } !v[i] v[i] v i {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                } t++ t l.add(i) l.add l i for(int j=2*i;j<100001;j+=i)
                        v[j]=true; int j=2*i; int j=2*i; j 2*i 2 i j<100001 j 100001 j+=i j+=i j i v[j]=true; v[j]=true v[j] v j true static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        } binary {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        } int mid=0 mid 0 l=0 l 0 r=n-1 r n-1 n 1 ans=0; ans 0 while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            } l<=r l r {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            } mid=(l+r)>>1 mid (l+r)>>1 (l+r) l r 1 if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                } a[mid].a==val a[mid].a a[mid] a mid a[mid].a val {
                    r=mid-1;
                    ans=mid;
                } r=mid-1 r mid-1 mid 1 ans=mid ans mid if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                } a[mid].a>val a[mid].a a[mid] a mid a[mid].a val r=mid-1 r mid-1 mid 1 {
                    l=mid+1;
                    ans=l;
                } l=mid+1 l mid+1 mid 1 ans=l ans l return (ans); (ans) pair a[] a int val val int n n static class pair{
        int a;
        int b;
        public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        }
    } pair int a; a int b; b public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        } pair {
            this.a=a;
            this.b=n;
        } this.a=a this.a this this.a a this.b=n this.b this this.b n int a a int n n static class solver
    {
        void solve()
        {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        }
    } solver void solve()
        {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        } solve {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        } String s=sc.next(); s sc.next() sc.next sc int s1=Integer.parseInt(s.substring(0,2)); s1 Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int s2=Integer.parseInt(s.substring(2)); s2 Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA"); (s1>=1 && s1<=12) && (s2>=1 && s2<=12) (s1>=1 && s1<=12) s1>=1 s1 1 s1<=12 s1 12 (s2>=1 && s2<=12) s2>=1 s2 1 s2<=12 s2 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA"); (s1>=1 && s1<=12) && (s2>12 || s2==0) (s1>=1 && s1<=12) s1>=1 s1 1 s1<=12 s1 12 (s2>12 || s2==0) s2>12 s2 12 s2==0 s2 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA"); (s1>12 || s1==0) && (s2>=1 && s2<=12) (s1>12 || s1==0) s1>12 s1 12 s1==0 s1 0 (s2>=1 && s2<=12) s2>=1 s2 1 s2<=12 s2 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA"); (s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12) (s1==0 && s2==0) (s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12) (s1==0 && s2>12) s1==0 s1 0 s2>12 s2 12 (s1>12 && s2==0) s1>12 s1 12 s2==0 s2 0 (s1==0 && s2==0) s1==0 s1 0 s2==0 s2 0 (s1>12 && s2>12) s1>12 s1 12 s2>12 s2 12 System.out.println("NA") System.out.println System.out System System.out "NA"

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 class Main {

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    static class card{
        long a;
        int cnt;
        int i;
        public card(long a,int cnt,int i)
        {
            this.a=a;
            this.cnt=cnt;
            this.i=i;
        }
    }

    static class ascend implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            if(o1.b!=o2.b)
                return (int)(o1.b-o2.b);
            else 
                return o1.a-o2.a;
        }
    }

    /*static class descend implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a){
    return (o1.a-o2.a)*-1;
    } else {
    return (o1.b-o2.b);
    }
    }
    }*/

    static class extra
    {

        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }

        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }

        static int binary(pair a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid].a==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid].a>val)
                    r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans);
        }
    }

    static class pair{
        int a;
        int b;
        public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public static void main(String[] args) {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
           String s=sc.next();
           int s1=Integer.parseInt(s.substring(0,2));
           int s2=Integer.parseInt(s.substring(2));
           if((s1>=1 && s1<=12) && (s2>=1 && s2<=12))
           System.out.println("AMBIGUOUS");
           else if((s1>=1 && s1<=12) && (s2>12 || s2==0))
           System.out.println("MMYY");
           else if((s1>12 || s1==0) && (s2>=1 && s2<=12))
           System.out.println("YYMM");
           else if((s1==0 && s2>12) ||(s1>12 && s2==0) ||(s1==0 && s2==0) || (s1>12 && s2>12))
           System.out.println("NA");
        }
    }
}