import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } 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();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }      
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }      
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } 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 String A = S.substring(0,2); A S.substring(0,2) S.substring S 0 2 String B = S.substring(2,4); B S.substring(2,4) S.substring S 2 4 int AA = Integer.parseInt(A); AA Integer.parseInt(A) Integer.parseInt Integer A int BB = Integer.parseInt(B); BB Integer.parseInt(B) Integer.parseInt Integer B if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    } AA >=1 && AA <= 12 AA >=1 AA 1 AA <= 12 AA 12 {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      } BB >=1 && BB <= 12 BB >=1 BB 1 BB <= 12 BB 12 {
        System.out.println("AMBIGUOUS");
      } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
        System.out.println("MMYY");
      } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    } if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      } BB >=1 && BB <= 12 BB >=1 BB 1 BB <= 12 BB 12 {
        System.out.println("YYMM");
      } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
        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();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }      
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } 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();
    String A = S.substring(0,2);
    String B = S.substring(2,4);
    int AA = Integer.parseInt(A);
    int BB = Integer.parseInt(B);
    if(AA >=1 && AA <= 12) {
      if(BB >=1 && BB <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("MMYY");
      }
    } else {
      if (BB >=1 && BB <= 12) {
        System.out.println("YYMM");
      } else {
        System.out.println("NA");
      }
    }      
  }
}