import java.io.*;
import java.util.*;
import java.util.Map.Entry;

		
public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}		 import java.io.*; io.* java import java.util.*; util.* java import java.util.Map.Entry; Entry java.util.Map public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
} Main public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    } main {
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    } MScanner sc = new MScanner(System.in); sc new MScanner(System.in) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) String x=sc.nextLine(); x sc.nextLine() sc.nextLine sc int f=Integer.parseInt(x.substring(0,2)); f Integer.parseInt(x.substring(0,2)) Integer.parseInt Integer x.substring(0,2) x.substring x 0 2 int s=Integer.parseInt(x.substring(2)); s Integer.parseInt(x.substring(2)) Integer.parseInt Integer x.substring(2) x.substring x 2 if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        } f<=12 && f>0 && s<=12 && s>0 s<=12 f<=12 && f>0 && s<=12 && s>0 f<=12 f 12 f>0 f 0 s<=12 s 12 s>0 s 0 {
        	pw.println("AMBIGUOUS");
        } pw.println("AMBIGUOUS") pw.println pw "AMBIGUOUS" {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        } if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	} (f>12 || f<=0) && (s>12 || s<=0) (f>12 || f<=0) f>12 f 12 f<=0 f 0 (s>12 || s<=0) s>12 s 12 s<=0 s 0 {
        		pw.println("NA");
        	} pw.println("NA") pw.println pw "NA" {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	} if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		} f<=12 && f>0 f<=12 f 12 f>0 f 0 {
        			pw.println("MMYY");
        		} pw.println("MMYY") pw.println pw "MMYY" {
        			pw.println("YYMM");
        		} pw.println("YYMM") pw.println pw "YYMM" pw.flush() pw.flush pw String[] args args static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    } MScanner StringTokenizer st; st BufferedReader br; br public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        } MScanner {
            br = new BufferedReader(new InputStreamReader(s));
        } br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String nextLine() throws IOException {
            return br.readLine();
        } nextLine {
            return br.readLine();
        } return br.readLine(); br.readLine() br.readLine br public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        } nextDouble {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        } String x = next(); x next() next StringBuilder sb = new StringBuilder("0"); sb new StringBuilder("0") double res = 0 res 0 f = 1; f 1 boolean dec = false dec false neg = false; neg false int start = 0; start 0 if (x.charAt(0) == '-') {
                neg = true;
                start++;
            } x.charAt(0) == '-' x.charAt(0) x.charAt x 0 '-' {
                neg = true;
                start++;
            } neg = true neg true start++ start for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } int i = start; int i = start; i start i < x.length() i x.length() x.length x i++ i++ i if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } x.charAt(i) == '.' x.charAt(i) x.charAt x i '.' {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } res = Long.parseLong(sb.toString()) res Long.parseLong(sb.toString()) Long.parseLong Long sb.toString() sb.toString sb sb = new StringBuilder("0") sb new StringBuilder("0") dec = true dec true {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                } sb.append(x.charAt(i)) sb.append sb x.charAt(i) x.charAt x i if (dec)
                        f *= 10; dec f *= 10 f 10 res += Long.parseLong(sb.toString()) / f res Long.parseLong(sb.toString()) / f Long.parseLong(sb.toString()) Long.parseLong Long sb.toString() sb.toString sb f return res * (neg ? -1 : 1); res * (neg ? -1 : 1) res (neg ? -1 : 1) neg -1 1 1 public boolean ready() throws IOException {
            return br.ready();
        } ready {
            return br.ready();
        } return br.ready(); br.ready() br.ready br public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
} public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
} Main
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

		
public class Main {
	public static void main(String[] args) throws Exception{
		MScanner sc = new MScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String x=sc.nextLine();
        int f=Integer.parseInt(x.substring(0,2));int s=Integer.parseInt(x.substring(2));
        if(f<=12 && f>0 && s<=12 && s>0) {
        	pw.println("AMBIGUOUS");
        }
        else {
        	if((f>12 || f<=0) && (s>12 || s<=0)) {
        		pw.println("NA");
        	}
        	else {
        		if(f<=12 && f>0) {
        			pw.println("MMYY");
        		}
        		else {
        			pw.println("YYMM");
        		}
        	}
        }
        pw.flush();
    }
	
	static class MScanner {
        StringTokenizer st;
        BufferedReader br;

        public MScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}		