/* package codechef; // don't place package name! */
   
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
     static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     }
    //   static int MAX=1000001;boolean prime[] = new boolean[MAX]; 
      
    //   static void sieveOfEratosthenes() { 
    //       for(int m9=0;m9<MAX;m9++) prime[m9]=true;
    //     for(int p = 2; p*p <=n; p++) { 
    //         if(prime[p] == true) 
    //         { 
    //             // Update all multiples of p 
    //             for(int i = p*2; i <= n; i += p) 
    //                 prime[i] = false; 
    //         } 
    //     } 
    //   }
      
     static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } 
     static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
     static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     }    
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
     static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     }
    //   static int MAX=1000001;boolean prime[] = new boolean[MAX]; 
      
    //   static void sieveOfEratosthenes() { 
    //       for(int m9=0;m9<MAX;m9++) prime[m9]=true;
    //     for(int p = 2; p*p <=n; p++) { 
    //         if(prime[p] == true) 
    //         { 
    //             // Update all multiples of p 
    //             for(int i = p*2; i <= n; i += p) 
    //                 prime[i] = false; 
    //         } 
    //     } 
    //   }
      
     static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } 
     static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
     static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     }    
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	} main {
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	} FastReader sc=new FastReader(); sc new FastReader() String s=sc.next(); s sc.next() sc.next sc char ch[]=s.toCharArray(); ch s.toCharArray() s.toCharArray s int num1=(ch[0]-'0')*10+(ch[1]-'0') num1 (ch[0]-'0')*10+(ch[1]-'0') (ch[0]-'0')*10 (ch[0]-'0') ch[0] ch 0 '0' 10 (ch[1]-'0') ch[1] ch 1 '0' flag1=0 flag1 0 flag2=0; flag2 0 int num2=(ch[2]-'0')*10+(ch[3]-'0'); num2 (ch[2]-'0')*10+(ch[3]-'0') (ch[2]-'0')*10 (ch[2]-'0') ch[2] ch 2 '0' 10 (ch[3]-'0') ch[3] ch 3 '0' if(num1>=1 && num1<=12) flag1=1; num1>=1 && num1<=12 num1>=1 num1 1 num1<=12 num1 12 flag1=1 flag1 1 if(num2>=1 && num2<=12) flag2=1; num2>=1 && num2<=12 num2>=1 num2 1 num2<=12 num2 12 flag2=1 flag2 1 if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA"); flag1==1 && flag2==1 flag1==1 flag1 1 flag2==1 flag2 1 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA"); flag2==1 flag2 1 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA"); flag1==1 flag1 1 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     } lower_bound {
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     } int n=a.length n a.length a a.length low=0 low 0 high=n-1 high n-1 n 1 res=-1; res -1 1 while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         } low<=high low high {
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         } int mid=(low+high)>>1; mid (low+high)>>1 (low+high) low high 1 if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1; a[mid]>=x a[mid] a mid x {
                res=mid;high=mid-1;
             } res=mid res mid high=mid-1 high mid-1 mid 1 low=mid+1 low mid+1 mid 1 return res; res int a[] a int x x static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     } upper_bound {
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     } int n=a.length n a.length a a.length low=0 low 0 high=n-1 high n-1 n 1 res=-1; res -1 1 while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          } low<=high low high {
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          } int mid=(low+high)>>1; mid (low+high)>>1 (low+high) low high 1 if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1; a[mid]<=x a[mid] a mid x {
                  res=mid;low=mid+1;
              } res=mid res mid low=mid+1 low mid+1 mid 1 high=mid-1 high mid-1 mid 1 return res; res int a[] a int x x static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } modexpo {
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m; n==0 n 0 return 1; 1 if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m; n%2==0 n%2 n 2 0 return (modexpo(((x%m)*(x%m))%m,n/2,m))%m; (modexpo(((x%m)*(x%m))%m,n/2,m))%m (modexpo(((x%m)*(x%m))%m,n/2,m)) modexpo ((x%m)*(x%m))%m ((x%m)*(x%m)) (x%m) x m (x%m) x m m n/2 n 2 m m return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m; ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m)) (x%m) x m ((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m) (modexpo(((x%m)*(x%m))%m,(n-1)/2,m)) modexpo ((x%m)*(x%m))%m ((x%m)*(x%m)) (x%m) x m (x%m) x m m (n-1)/2 (n-1) n 1 2 m m m long x x long n n long m m static int gcd(int a,int 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 int a a int b b 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 class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     } FastReader BufferedReader in; in StringTokenizer st; st public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          } FastReader {
              in=new BufferedReader(new InputStreamReader(System.in));
          } in=new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            } next {
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            } while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               } st==null || !st.hasMoreElements() st==null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               } try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  } catch(IOException e){
                      e.printStackTrace();
                  } IOException e {
                      e.printStackTrace();
                  } e.printStackTrace() e.printStackTrace e {
                      st=new StringTokenizer(in.readLine());
                  } st=new StringTokenizer(in.readLine()) st new StringTokenizer(in.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt(){
                return Integer.parseInt(next());
            } nextInt {
                return Integer.parseInt(next());
            } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong(){
                return Long.parseLong(next());
            } nextLong {
                return Long.parseLong(next());
            } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble(){
                return Double.parseDouble(next());
            } nextDouble {
                return Double.parseDouble(next());
            } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        } nextLine {
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        } String str19 = ""; str19 "" try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             } catch (IOException e){ 
                e.printStackTrace();
             } IOException e { 
                e.printStackTrace();
             } e.printStackTrace() e.printStackTrace e {
                str19 = in.readLine();
            } str19 = in.readLine() str19 in.readLine() in.readLine in return str19; str19 public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
     static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     }
    //   static int MAX=1000001;boolean prime[] = new boolean[MAX]; 
      
    //   static void sieveOfEratosthenes() { 
    //       for(int m9=0;m9<MAX;m9++) prime[m9]=true;
    //     for(int p = 2; p*p <=n; p++) { 
    //         if(prime[p] == true) 
    //         { 
    //             // Update all multiples of p 
    //             for(int i = p*2; i <= n; i += p) 
    //                 prime[i] = false; 
    //         } 
    //     } 
    //   }
      
     static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } 
     static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
     static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     }    
} public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
     static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     }
    //   static int MAX=1000001;boolean prime[] = new boolean[MAX]; 
      
    //   static void sieveOfEratosthenes() { 
    //       for(int m9=0;m9<MAX;m9++) prime[m9]=true;
    //     for(int p = 2; p*p <=n; p++) { 
    //         if(prime[p] == true) 
    //         { 
    //             // Update all multiples of p 
    //             for(int i = p*2; i <= n; i += p) 
    //                 prime[i] = false; 
    //         } 
    //     } 
    //   }
      
     static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } 
     static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
     static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     }    
} Main
/* package codechef; // don't place package name! */
   
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
// 		constructST(a,n);RMQ(n, qs, qe)
		String s=sc.next();
		char ch[]=s.toCharArray();
		
		int num1=(ch[0]-'0')*10+(ch[1]-'0'),flag1=0,flag2=0;
		int num2=(ch[2]-'0')*10+(ch[3]-'0');
		
		if(num1>=1 && num1<=12) flag1=1;
		
		if(num2>=1 && num2<=12) flag2=1;
		
		if(flag1==1 && flag2==1)
			System.out.println("AMBIGUOUS");
		else if(flag2==1)
			System.out.println("YYMM");
		else if(flag1==1)
			System.out.println("MMYY");
		else 
			System.out.println("NA");
	}
	static int lower_bound(int a[],int x){
         int n=a.length,low=0,high=n-1,res=-1;
         while(low<=high){
             int mid=(low+high)>>1;
             if(a[mid]>=x){
                res=mid;high=mid-1;
             }
             else 
                low=mid+1;
         }
         return res;
     }
     static int upper_bound(int a[],int x){
          int n=a.length,low=0,high=n-1,res=-1;
          while(low<=high){
              int mid=(low+high)>>1;
              if(a[mid]<=x){
                  res=mid;low=mid+1;
              }
              else 
                  high=mid-1;
          }
          return res;
     }
    //   static int MAX=1000001;boolean prime[] = new boolean[MAX]; 
      
    //   static void sieveOfEratosthenes() { 
    //       for(int m9=0;m9<MAX;m9++) prime[m9]=true;
    //     for(int p = 2; p*p <=n; p++) { 
    //         if(prime[p] == true) 
    //         { 
    //             // Update all multiples of p 
    //             for(int i = p*2; i <= n; i += p) 
    //                 prime[i] = false; 
    //         } 
    //     } 
    //   }
      
     static long modexpo(long x,long n,long m){
        if(n==0)
            return 1;
        else if(n%2==0)
            return (modexpo(((x%m)*(x%m))%m,n/2,m))%m;
        else
            return ((x%m)*((modexpo(((x%m)*(x%m))%m,(n-1)/2,m))%m))%m;
     } 
     static int gcd(int a,int b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
     static long gcd(long a,long b){
           if(b==0)
              return a;
           else 
              return gcd(b,a%b);
     }
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){ 
                e.printStackTrace();
             }
            return str19;
        }
     }    
}