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

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
} 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) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
} Main public static void main(String[] args) {

    new Main().run();
  } main {

    new Main().run();
  } new Main().run() new Main().run new Main() String[] args args public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  } run {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  } try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    } catch(IOException e) {

      System.err.println(e);
    } IOException e {

      System.err.println(e);
    } System.err.println(e) System.err.println System.err System System.err e {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String S = in.readLine(); S in.readLine() in.readLine in int f = Integer.parseInt(S.substring(0, 2)); f Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int s = Integer.parseInt(S.substring(2, 4)); s Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 String ans; ans if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA"; isMonth(f) && isMonth(s) isMonth(f) isMonth f isMonth(s) isMonth s ans = "AMBIGUOUS" ans "AMBIGUOUS" if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA"; isMonth(f) && !isMonth(s) isMonth(f) isMonth f !isMonth(s) isMonth(s) isMonth s ans = "MMYY" ans "MMYY" if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA"; !isMonth(f) && isMonth(s) !isMonth(f) isMonth(f) isMonth f isMonth(s) isMonth s ans = "YYMM" ans "YYMM" ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  } isMonth {
    return 1 <= m && m <= 12;
  } return 1 <= m && m <= 12; 1 <= m && m <= 12 1 <= m 1 m m <= 12 m 12 int m m public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
} public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String S = in.readLine();

      int f = Integer.parseInt(S.substring(0, 2));
      int s = Integer.parseInt(S.substring(2, 4));

      String ans;
      if(isMonth(f) && isMonth(s)) ans = "AMBIGUOUS";
      else if (isMonth(f) && !isMonth(s)) ans = "MMYY";
      else if (!isMonth(f) && isMonth(s)) ans = "YYMM";
      else ans = "NA";

      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }

  public boolean isMonth(int m) {
    return 1 <= m && m <= 12;
  }
}