private List<List<String>> getConnectedLines(List<String> line1) {
        List<List<String>> connected = new ArrayList<List<String>>();
        for (List<String> line : lines) {
            if (!line.equals(line1)) {
                if (!intersection(line1, line).isEmpty()) {
                    connected.add(line);
                }
            }
        }
        return connected;
    }