import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    } main {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    } BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); stdin new BufferedReader(new InputStreamReader(System.in)) String s = stdin.readLine(); s stdin.readLine() stdin.readLine stdin int a = Integer.parseInt(s.substring(0, 2)); a Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int b = Integer.parseInt(s.substring(2)); b Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 boolean yymm = 01 <= b && b <= 12; yymm 01 <= b && b <= 12 01 <= b 01 b b <= 12 b 12 boolean mmyy = 01 <= a && a <= 12; mmyy 01 <= a && a <= 12 01 <= a 01 a a <= 12 a 12 String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA"; ans (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA" (yymm && mmyy) yymm mmyy "AMBIGUOUS" yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA" yymm "YYMM" mmyy          ? "MMYY"      : "NA" mmyy "MMYY" "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String s = stdin.readLine();
        
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2));
        boolean yymm = 01 <= b && b <= 12;
        boolean mmyy = 01 <= a && a <= 12;
        
        String ans = (yymm && mmyy) ? "AMBIGUOUS" :
                      yymm          ? "YYMM"      :
                      mmyy          ? "MMYY"      : "NA";
        System.out.println(ans);
    }
}
