
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.io.IOException;
import java.lang.String;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.BitSet;
import java.io.IOException;
import java.util.Arrays;
import java.util.GregorianCalendar;

public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigInteger; BigInteger java.math import java.util.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.lang.String; String java.lang import java.util.ArrayList; ArrayList java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex import java.util.Scanner; Scanner java.util import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.StringTokenizer; StringTokenizer java.util import java.util.BitSet; BitSet java.util import java.io.IOException; IOException java.io import java.util.Arrays; Arrays java.util import java.util.GregorianCalendar; GregorianCalendar java.util public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }

} Main static BigInteger modulo = new BigInteger("1000000007"); modulo new BigInteger("1000000007") static long mod = 1000000007; mod 1000000007 static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    } exponentialModulo {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    } BigInteger previousNumber = BigInteger.ONE; previousNumber BigInteger.ONE BigInteger BigInteger.ONE while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        } !(b.equals(BigInteger.valueOf(0))) (b.equals(BigInteger.valueOf(0))) b.equals b BigInteger.valueOf(0) BigInteger.valueOf BigInteger 0 {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        } if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            } b.testBit(0) b.testBit b 0 {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            } previousNumber = previousNumber.multiply(a).mod(modulo) previousNumber previousNumber.multiply(a).mod(modulo) previousNumber.multiply(a).mod previousNumber.multiply(a) previousNumber.multiply previousNumber a modulo b = b.shiftRight(1) b b.shiftRight(1) b.shiftRight b 1 a = a.modPow(BigInteger.valueOf(2), modulo) a a.modPow(BigInteger.valueOf(2), modulo) a.modPow a BigInteger.valueOf(2) BigInteger.valueOf BigInteger 2 modulo return previousNumber; previousNumber BigInteger a a BigInteger b b public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    } applySearchOfSubstring {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    } int count = 0; count 0 Pattern p = Pattern.compile("AB"); p Pattern.compile("AB") Pattern.compile Pattern "AB" Matcher m = p.matcher(text); m p.matcher(text) p.matcher p text while (m.find()) {
            ++count;
        } m.find() m.find m {
            ++count;
        } ++count count return count; count String text text public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    } main {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    } FastReader input = new FastReader(); input new FastReader() String s = input.nextLine(); s input.nextLine() input.nextLine input String a = s.substring(0,2); a s.substring(0,2) s.substring s 0 2 String b = s.substring(2,4); b s.substring(2,4) s.substring s 2 4 int x = Integer.parseInt(a); x Integer.parseInt(a) Integer.parseInt Integer a int y = Integer.parseInt(b); y Integer.parseInt(b) Integer.parseInt Integer b if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } x >= 1 && y >= 1 && x <= 12 && y <= 12 x <= 12 x >= 1 && y >= 1 && x <= 12 && y <= 12 x >= 1 x 1 y >= 1 y 1 x <= 12 x 12 y <= 12 y 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } x >= 1 && x <= 12 x >= 1 x 1 x <= 12 x 12 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } y >= 1 && y <= 12 y >= 1 y 1 y <= 12 y 12 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    } FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        } FastReader {
            br = new BufferedReader(new InputStreamReader(System.in));
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            } try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                } catch (IOException io) {
                    io.printStackTrace();
                } IOException io {
                    io.printStackTrace();
                } io.printStackTrace() io.printStackTrace io {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st 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 public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        } nextLine {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        } String s = ""; s "" try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            } catch (IOException io) {
                io.printStackTrace();
            } IOException io {
                io.printStackTrace();
            } io.printStackTrace() io.printStackTrace io {
                s = br.readLine();
            } s = br.readLine() s br.readLine() br.readLine br return s; s public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }

} public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }

} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.io.IOException;
import java.lang.String;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.BitSet;
import java.io.IOException;
import java.util.Arrays;
import java.util.GregorianCalendar;

public class Main {

    static BigInteger modulo = new BigInteger("1000000007");
    static long mod = 1000000007;
//    Nested ststic class FastReaders

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException io) {
                io.printStackTrace();
            }
            return s;
        }
    }

    static BigInteger exponentialModulo(BigInteger a, BigInteger b) {
        BigInteger previousNumber = BigInteger.ONE;
        while (!(b.equals(BigInteger.valueOf(0)))) {
            if (b.testBit(0)) {
                previousNumber = previousNumber.multiply(a).mod(modulo);
            }
            b = b.shiftRight(1);
            a = a.modPow(BigInteger.valueOf(2), modulo);
        }
        return previousNumber;
    }

    public static int applySearchOfSubstring(String text) {
        int count = 0;
        Pattern p = Pattern.compile("AB");
        Matcher m = p.matcher(text);
        while (m.find()) {
            ++count;
        }

        return count;
    }

    public static void main(String[] args) throws IOException {
        FastReader input = new FastReader();
        String s = input.nextLine();
        String a = s.substring(0,2);
        String b = s.substring(2,4);
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
//        System.out.println(x + " " + y);
        if(x >= 1 && y >= 1 && x <= 12 && y <= 12){
            System.out.println("AMBIGUOUS");
        }else if(x >= 1 && x <= 12 ){
            System.out.println("MMYY");
        }else if(y >= 1 && y <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }

}
