public void solve() throws IOException {
    HashMap<Integer, String> map = new HashMap<Integer, String>();
    for (int x = 0; x < ans.length; x++) {
      String[] dat = ans[x].split(":");
      map.put(Integer.parseInt(dat[0]), dat[1]);
    }
    
    int n;
    while ((n = nextInt()) != -1) {
      if (map.containsKey(n)) {
        System.out.format("%d = %s%n", n, map.get(n));
      } else {
        System.out.format("%d is NOT perfect.%n", n);
      }
    }
  }