import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    }
} Main public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    } main {
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    } Scanner scan = new java.util.Scanner(System.in); scan new java.util.Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan int a = 0; a 0 int b = 0; b 0 int c = 4; c 4 a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1)) a Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1)) Character.getNumericValue(s.charAt(0)) * 10 Character.getNumericValue(s.charAt(0)) Character.getNumericValue Character s.charAt(0) s.charAt s 0 10 Character.getNumericValue(s.charAt(1)) Character.getNumericValue Character s.charAt(1) s.charAt s 1 b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3)) b Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3)) Character.getNumericValue(s.charAt(2)) * 10 Character.getNumericValue(s.charAt(2)) Character.getNumericValue Character s.charAt(2) s.charAt s 2 10 Character.getNumericValue(s.charAt(3)) Character.getNumericValue Character s.charAt(3) s.charAt s 3 if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        } 1 <= a && a <= 12 1 <= a 1 a a <= 12 a 12 {
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        } if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            } 1 <= b && b <= 12 1 <= b 1 b b <= 12 b 12 {
                c = 3;
            } c = 3 c 3 {
                c = 2;
            } c = 2 c 2 if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        } 1 <= b && b <= 12 1 <= b 1 b b <= 12 b 12 {
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        } if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            } 1 <= a && a <= 12 1 <= a 1 a a <= 12 a 12 {
                c = 3;
            } c = 3 c 3 {
                c = 1;
            } c = 1 c 1 if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        } c == 1 c 1 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        } c == 2 c 2 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        } c == 3 c 3 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        int c = 4;
        a = Character.getNumericValue(s.charAt(0)) * 10 + Character.getNumericValue(s.charAt(1));
        b = Character.getNumericValue(s.charAt(2)) * 10 + Character.getNumericValue(s.charAt(3));
        if(1 <= a && a <= 12){
            if(1 <= b && b <= 12){
                c = 3;
            }else{
                c = 2;
            }
        }else if(1 <= b && b <= 12){
            if(1 <= a && a <= 12){
                c = 3;
            }else{
                c = 1;
            }
        }
        if(c == 1){
            System.out.println("YYMM");
        }else if(c == 2){
            System.out.println("MMYY");
        }else if(c == 3){
            System.out.println("AMBIGUOUS");
        }else{
            System.out.println("NA");
        }
    }
}