def node_lists_with_cuboids(node_lists_flat):
    """Finds adjacent points in node_lists_flat and converts them to cuboids for data efficiency"""
    node_lists = {}
    for item, v in node_lists_flat.items():
        node_lists[item] = []
        vs = sorted(v)
        while len(vs) > 0:
            start_x, start_y, start_z = vs[0]
            dx, dy, dz = 0, 0, 0
            tfx, tfy, tfz = True, True, True
            while tfx or tfy or tfz:
                if tfx:
                    x = start_x + dx + 1
                    for y in range(start_y, start_y + dy + 1):
                        for z in range(start_z, start_z + dz + 1):
                            if not (x, y, z) in vs:
                                tfx = False
                    if tfx:
                        dx += 1
                if tfy:
                    y = start_y + dy + 1
                    for x in range(start_x, start_x + dx + 1):
                        for z in range(start_z, start_z + dz + 1):
                            if not (x, y, z) in vs:
                                tfy = False
                    if tfy:
                        dy += 1
                if tfz:
                    z = start_z + dz + 1
                    for x in range(start_x, start_x + dx + 1):
                        for y in range(start_y, start_y + dy + 1):
                            if not (x, y, z) in vs:
                                tfz = False
                    if tfz:
                        dz += 1
            if dx == 0 and dy == 0 and dz == 0:
                node_lists[item].append((start_x, start_y, start_z))
            else:
                node_lists[item].append(((start_x, start_y, start_z), (
                    start_x + dx, start_y + dy, start_z + dz)))
            for x in range(start_x, start_x + dx + 1):
                for y in range(start_y, start_y + dy + 1):
                    for z in range(start_z, start_z + dz + 1):
                        vs.remove((x, y, z))
    return node_lists
