private static void bump(ArrayList<ArrayList<Integer>> rows, int w) {
        if (rows.size() == 0) {
            rows.add(new ArrayList<Integer>());
            rows.get(0).add(w);
            return;
        }
        for (ArrayList<Integer> row : rows) {
            int i = 0;
            while (i < row.size() && row.get(i) <= w) {
                i++;
            }
            if (i == row.size()) {
                row.add(w);
                return;
            } else if (i == 0 || i > 0 && (row.get(i - 1) != w || row.get(i) != w + 1)) {
                int t = row.get(i);
                row.set(i, w);
                w = t;
            } else {
                w++;
            }
        }
        ArrayList<Integer> newRow = new ArrayList<Integer>();
        newRow.add(w);
        rows.add(newRow);
    }