import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc int L = Integer.parseInt(str.substring(0,2)); L Integer.parseInt(str.substring(0,2)) Integer.parseInt Integer str.substring(0,2) str.substring str 0 2 int R = Integer.parseInt(str.substring(2,4)); R Integer.parseInt(str.substring(2,4)) Integer.parseInt Integer str.substring(2,4) str.substring str 2 4 if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } L >= 1 && L <= 12 L >= 1 L 1 L <= 12 L 12 {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            } R >= 1 && R <= 12 R >= 1 R 1 R <= 12 R 12 {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        } if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            } R >= 1 && R <= 12 R >= 1 R 1 R <= 12 R 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 public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int L = Integer.parseInt(str.substring(0,2));
        int R = Integer.parseInt(str.substring(2,4));
        if (L >= 1 && L <= 12) {
            if (R >= 1 && R <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (R >= 1 && R <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
}