import java.util.*;

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

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int first = Integer.parseInt(s.substring(0,2), 10); first Integer.parseInt(s.substring(0,2), 10) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 10 int second = Integer.parseInt(s.substring(2,4), 10); second Integer.parseInt(s.substring(2,4), 10) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 10 if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    } second >= 1 && second <= 12 second >= 1 second 1 second <= 12 second 12 {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      } first >= 1 && first <= 12 first >= 1 first 1 first <= 12 first 12 {
        System.out.println("AMBIGUOUS");
      } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
        System.out.println("YYMM");
      } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    } if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      } first >= 1 && first <= 12 first >= 1 first 1 first <= 12 first 12 {
        System.out.println("MMYY");
      } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
        System.out.println("NA");
      } 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) {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
} Main
import java.util.*;

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

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
}
