import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String s1 = s.substring(0, 2); s1 s.substring(0, 2) s.substring s 0 2 String s2 = s.substring(2); s2 s.substring(2) s.substring s 2 int t1 = Integer.parseInt(s1); t1 Integer.parseInt(s1) Integer.parseInt Integer s1 int t2 = Integer.parseInt(s2); t2 Integer.parseInt(s2) Integer.parseInt Integer s2 int p1 = 0; p1 0 int p2 = 0; p2 0 if((t2 > 0) && (t2 <= 12)) p1++; (t2 > 0) && (t2 <= 12) (t2 > 0) t2 0 (t2 <= 12) t2 12 p1++ p1 if((t1 > 0) && (t1 <= 12)) p2++; (t1 > 0) && (t1 <= 12) (t1 > 0) t1 0 (t1 <= 12) t1 12 p2++ p2 String ans = "NA"; ans "NA" if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    } p1 == 1 p1 1 {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      } p2 == 1 p2 1 {
        ans = "AMBIGUOUS";
      } ans = "AMBIGUOUS" ans "AMBIGUOUS" {
        ans = "YYMM";
      } ans = "YYMM" ans "YYMM" {
      if(p2 == 1) ans = "MMYY";
    } if(p2 == 1) ans = "MMYY"; p2 == 1 p2 1 ans = "MMYY" ans "MMYY" 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 sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String s1 = s.substring(0, 2);
    String s2 = s.substring(2);
    int t1 = Integer.parseInt(s1);
    int t2 = Integer.parseInt(s2);
    int p1 = 0;
    int p2 = 0;
    if((t2 > 0) && (t2 <= 12)) p1++;
    if((t1 > 0) && (t1 <= 12)) p2++;
    String ans = "NA";
    if(p1 == 1) {
      if(p2 == 1) {
        ans = "AMBIGUOUS";
      } else {
        ans = "YYMM";
      }
    } else {
      if(p2 == 1) ans = "MMYY";
    }
    System.out.println(ans);
  }
}