
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
 
    private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
 
    private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    }
} Main public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    } main {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    } final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final char[] chars = scanner.nextLine().toCharArray(); chars scanner.nextLine().toCharArray() scanner.nextLine().toCharArray scanner.nextLine() scanner.nextLine scanner if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3]) isMonth(chars[0],chars[1]) isMonth chars[0] chars 0 chars[1] chars 1 isMonth(chars[2],chars[3]) isMonth chars[2] chars 2 chars[3] chars 3 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3]) isMonth(chars[0], chars[1]) isMonth chars[0] chars 0 chars[1] chars 1 !isMonth(chars[2], chars[3]) isMonth(chars[2], chars[3]) isMonth chars[2] chars 2 chars[3] chars 3 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        } !isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3]) !isMonth(chars[0],chars[1]) isMonth(chars[0],chars[1]) isMonth chars[0] chars 0 chars[1] chars 1 isMonth(chars[2],chars[3]) isMonth chars[2] chars 2 chars[3] chars 3 {
            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 private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    } isMonth {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    } if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        } a == '0' a '0' {
            return !(b ==  '0');
        } return !(b ==  '0'); !(b ==  '0') (b ==  '0') b '0' if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        } a == '1' a '1' {
            return b == '0' || b == '1' || b == '2';
        } return b == '0' || b == '1' || b == '2'; b == '0' || b == '1' || b == '2' b == '0' || b == '1' || b == '2' b == '0' b '0' b == '1' b '1' b == '2' b '2' {
            return false;
        } return false; false final char a a final char b b public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
 
    private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    }
} public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
 
    private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    }
} Main

import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final char[] chars = scanner.nextLine().toCharArray();
 
        if(isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("AMBIGUOUS");
        } else if (isMonth(chars[0], chars[1]) && !isMonth(chars[2], chars[3])) {
            System.out.println("MMYY");
        } else if(!isMonth(chars[0],chars[1]) && isMonth(chars[2],chars[3])){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
 
    private static boolean isMonth(final char a, final char b) {
        if (a == '0') {
            return !(b ==  '0');
        } else if (a == '1') {
            return b == '0' || b == '1' || b == '2';
        } else {
            return false;
        }
    }
}
