public void solve() throws IOException {
    int n = nextInt();
    int[] loc = new int[n];
    ArrayList<Weight> weights = new ArrayList<Weight>();
    for (int x = 0; x < n; x++) {
      loc[x] = nextInt();
      weights.add(new Weight(x));
    }
    int k = nextInt();

    for (int x = 0; x < n; x++)
      for (int y = 0; y < n; y++)
        weights.get(x).add(Math.abs(loc[x] - loc[y]));

    for (int x = 0; x < n - k; x++) {
      Collections.sort(weights);
      int city = weights.get(0).name;
      for (int y = 0; y < weights.size(); y++) {
        int othercity = weights.get(y).name;
        weights.get(y).sub(Math.abs(loc[city] - loc[othercity]));
      }
      weights.remove(0);
    }
    for (int x = 0; x < k; x++) {
      System.out.print(weights.get(x).name + 1);
      if (x != k - 1)
        System.out.print(" ");
    }
    System.out.println();
  }