import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }

} import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.lang.Math; Math java.lang public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    } main {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    } String s = sc.next(); s sc.next() sc.next sc int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1)); fh Integer.parseInt("" + s.charAt(0) + s.charAt(1)) Integer.parseInt Integer "" + s.charAt(0) + s.charAt(1) "" + s.charAt(0) + s.charAt(1) "" s.charAt(0) s.charAt s 0 s.charAt(1) s.charAt s 1 int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3)); sh Integer.parseInt("" + s.charAt(2) + s.charAt(3)) Integer.parseInt Integer "" + s.charAt(2) + s.charAt(3) "" + s.charAt(2) + s.charAt(3) "" s.charAt(2) s.charAt s 2 s.charAt(3) s.charAt s 3 String ans; ans if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        } fh >= 0 && fh < 100 && sh > 0 && sh < 13 sh > 0 fh >= 0 && fh < 100 && sh > 0 && sh < 13 fh >= 0 fh 0 fh < 100 fh 100 sh > 0 sh 0 sh < 13 sh 13 {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            } sh >= 0 && sh < 100 && fh > 0 && fh < 13 fh > 0 sh >= 0 && sh < 100 && fh > 0 && fh < 13 sh >= 0 sh 0 sh < 100 sh 100 fh > 0 fh 0 fh < 13 fh 13 {
                ans = "AMBIGUOUS";
            } ans = "AMBIGUOUS" ans "AMBIGUOUS" {
                ans = "YYMM";
            } ans = "YYMM" ans "YYMM" if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        } sh >= 0 && sh < 100 && fh > 0 && fh < 13 fh > 0 sh >= 0 && sh < 100 && fh > 0 && fh < 13 sh >= 0 sh 0 sh < 100 sh 100 fh > 0 fh 0 fh < 13 fh 13 {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" {
            ans = "NA";
        } ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }

} public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }

} Main
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int fh = Integer.parseInt("" + s.charAt(0) + s.charAt(1));
        int sh = Integer.parseInt("" + s.charAt(2) + s.charAt(3));
        String ans;
        if (fh >= 0 && fh < 100 && sh > 0 && sh < 13) {
            if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
                ans = "AMBIGUOUS";
            } else {
                ans = "YYMM";
            }
        } else if (sh >= 0 && sh < 100 && fh > 0 && fh < 13) {
            ans = "MMYY";
        } else {
            ans = "NA";
        }
        System.out.println(ans);
    }

}
