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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s = in.readLine(); s in.readLine() in.readLine in int s_former = Integer.parseInt(s.substring(0,2)); s_former Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int s_latter = Integer.parseInt(s.substring(2,4)); s_latter Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); (s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12) (s_former>=1 && s_former<=12) s_former>=1 s_former 1 s_former<=12 s_former 12 (s_latter>=1 && s_latter<=12) s_latter>=1 s_latter 1 s_latter<=12 s_latter 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); s_former>=1 && s_former<=12 s_former>=1 s_former 1 s_former<=12 s_former 12 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA"); s_latter>=1 && s_latter<=12 s_latter>=1 s_latter 1 s_latter<=12 s_latter 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" 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) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int s_former = Integer.parseInt(s.substring(0,2));
    int s_latter = Integer.parseInt(s.substring(2,4));
    if((s_former>=1 && s_former<=12) && (s_latter>=1 && s_latter<=12))
      System.out.println("AMBIGUOUS");
    else if(s_former>=1 && s_former<=12)
      System.out.println("MMYY");
    else if(s_latter>=1 && s_latter<=12)
      System.out.println("YYMM");
    else
      System.out.println("NA");
  }
}