import java.util.Scanner; 

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

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  } main {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    } in.hasNext() in.hasNext in {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    } String S = in.next(); S in.next() in.next in int former = Integer.valueOf(S.substring(0, 2)); former Integer.valueOf(S.substring(0, 2)) Integer.valueOf Integer S.substring(0, 2) S.substring S 0 2 int later = Integer.valueOf(S.substring(2)); later Integer.valueOf(S.substring(2)) Integer.valueOf Integer S.substring(2) S.substring S 2 String ans = ""; ans "" if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } former == 0 former 0 {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        } later == 0 || later > 12 later == 0 later 0 later > 12 later 12 {
          ans = "NA";
        } ans = "NA" ans "NA" {
          ans = "YYMM";
        } ans = "YYMM" ans "YYMM" if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } former <= 12 former 12 {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        } later == 0 || later > 12 later == 0 later 0 later > 12 later 12 {
          ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if (later <= 12) {
          ans = "AMBIGUOUS";
        } later <= 12 later 12 {
          ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } former > 12 former 12 {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        } later == 0 || later > 12 later == 0 later 0 later > 12 later 12 {
          ans = "NA";
        } ans = "NA" ans "NA" {
          ans = "YYMM";
        } ans = "YYMM" ans "YYMM" 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 in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

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

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  }
} Main
import java.util.Scanner; 

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

    while (in.hasNext()) {
      String S = in.next();
      int former = Integer.valueOf(S.substring(0, 2));
      int later = Integer.valueOf(S.substring(2));

      String ans = "";
      if (former == 0) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      } else if (former <= 12) {
        if (later == 0 || later > 12) {
          ans = "MMYY";
        } else if (later <= 12) {
          ans = "AMBIGUOUS";
        }        
      } else if (former > 12) {
        if (later == 0 || later > 12) {
          ans = "NA";
        } else {
          ans = "YYMM";
        }
      }

      System.out.println(ans);
    }
  }
}