import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  }

} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  }

} Main public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  } main {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String S = scn.nextLine(); S scn.nextLine() scn.nextLine scn int firstHalf = Integer.parseInt(S.substring(0, 2), 10); firstHalf Integer.parseInt(S.substring(0, 2), 10) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 10 int secondHalf = Integer.parseInt(S.substring(2, 4), 10); secondHalf Integer.parseInt(S.substring(2, 4), 10) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 10 boolean isYYMM = false; isYYMM false boolean isMMYY = false; isMMYY false if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    } secondHalf >= 1 && secondHalf <= 12 secondHalf >= 1 secondHalf 1 secondHalf <= 12 secondHalf 12 {
      isYYMM = true;
    } isYYMM = true isYYMM true if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    } firstHalf >= 1 && firstHalf <= 12 firstHalf >= 1 firstHalf 1 firstHalf <= 12 firstHalf 12 {
      isMMYY = true;
    } isMMYY = true isMMYY true String ans; ans if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    } isYYMM && isMMYY isYYMM isMMYY {
      ans = "AMBIGUOUS";
    } ans = "AMBIGUOUS" ans "AMBIGUOUS" if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    } isYYMM {
      ans = "YYMM";
    } ans = "YYMM" ans "YYMM" if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    } isMMYY {
      ans = "MMYY";
    } ans = "MMYY" ans "MMYY" {
      ans = "NA";
    } ans = "NA" ans "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) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  }

} public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  }

} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);

    String S = scn.nextLine();
    int firstHalf = Integer.parseInt(S.substring(0, 2), 10);
    int secondHalf = Integer.parseInt(S.substring(2, 4), 10);

    boolean isYYMM = false;
    boolean isMMYY = false;
    if (secondHalf >= 1 && secondHalf <= 12) {
      isYYMM = true;
    }
    if (firstHalf >= 1 && firstHalf <= 12) {
      isMMYY = true;
    }

    String ans;
    if (isYYMM && isMMYY) {
      ans = "AMBIGUOUS";
    } else if (isYYMM) {
      ans = "YYMM";
    } else if (isMMYY) {
      ans = "MMYY";
    } else {
      ans = "NA";
    }

    System.out.println(ans);
  }

}