

import java.util.Scanner;

public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    }
} Main public static int aa = 0; aa 0 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int zen = Integer.valueOf(s.substring(0, 2)); zen Integer.valueOf(s.substring(0, 2)) Integer.valueOf Integer s.substring(0, 2) s.substring s 0 2 int kou = Integer.valueOf(s.substring(2, 4)); kou Integer.valueOf(s.substring(2, 4)) Integer.valueOf Integer s.substring(2, 4) s.substring s 2 4 String res = "AMBIGUOUS"; res "AMBIGUOUS" if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        } 1 <= zen && zen <= 12 && 1 <= kou && kou <= 12 1 <= kou 1 <= zen && zen <= 12 && 1 <= kou && kou <= 12 1 <= zen 1 zen zen <= 12 zen 12 1 <= kou 1 kou kou <= 12 kou 12 {
            System.out.println("AMBIGUOUS");
            return;
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        } 12 < zen && 12 < kou 12 < zen 12 zen 12 < kou 12 kou {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        } zen < 0 || kou < 0 zen < 0 zen 0 kou < 0 kou 0 {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        } zen == 0 && kou == 0 zen == 0 zen 0 kou == 0 kou 0 {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        } zen == 0 && 0 < kou && kou <= 12 zen == 0 && 0 < kou && kou <= 12 zen == 0 zen 0 0 < kou 0 kou kou <= 12 kou 12 {
            System.out.println("YYMM");
            return;
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        } zen == 0 && 12 < kou zen == 0 zen 0 12 < kou 12 kou {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        } kou == 0 && 0 < zen && zen <= 12 kou == 0 && 0 < zen && zen <= 12 kou == 0 kou 0 0 < zen 0 zen zen <= 12 zen 12 {
            System.out.println("MMYY");
            return;
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        } kou == 0 && 12 < zen kou == 0 kou 0 12 < zen 12 zen {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        } 12 < zen 12 zen {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" String[] args args public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    }
} public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    }
} Main


import java.util.Scanner;

public class Main {

    public static int aa = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int zen = Integer.valueOf(s.substring(0, 2));
        int kou = Integer.valueOf(s.substring(2, 4));
        String res = "AMBIGUOUS";
        if (1 <= zen && zen <= 12 && 1 <= kou && kou <= 12) {
            System.out.println("AMBIGUOUS");
            return;
        }

        if (12 < zen && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (zen < 0 || kou < 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && kou == 0) {
            System.out.println("NA");
            return;
        }

        if (zen == 0 && 0 < kou && kou <= 12) {
            System.out.println("YYMM");
            return;
        } else if (zen == 0 && 12 < kou) {
            System.out.println("NA");
            return;
        }

        if (kou == 0 && 0 < zen && zen <= 12) {
            System.out.println("MMYY");
            return;
        }else if (kou == 0 && 12 < zen) {
            System.out.println("NA");
            return;
        }

        if (12 < zen) {
            System.out.println("YYMM");
        } else {
            System.out.println("MMYY");
        }
    }
}