/**
 * Given three sets of coordinates representing three lines in a civil engineering project,
 * find the common points between these lines using nested loops and sets.
 *
 * @param line1 set of coordinates representing the first line
 * @param line2 set of coordinates representing the second line
 * @param line3 set of coordinates representing the third line
 * @return set of coordinates representing the common points between the three lines
 */
fun findCommonPoints(line1: Set<Pair<Int, Int>>, line2: Set<Pair<Int, Int>>, line3: Set<Pair<Int, Int>>): Set<Pair<Int, Int>> {

    val commonPoints = mutableSetOf<Pair<Int, Int>>()

    // Iterate through the coordinates of line1
    for (point1 in line1) {
        // Iterate through the coordinates of line2
        for (point2 in line2) {
            // Iterate through the coordinates of line3
            for (point3 in line3) {
                // Check if the three points have the same coordinates
                if (point1 == point2 && point2 == point3) {
                    // Add the common point to the set
                    commonPoints.add(point1)
                }
            }
        }
    }

    return commonPoints
}

// Example usage
val line1 = setOf(Pair(0, 0), Pair(1, 1), Pair(2, 2))
val line2 = setOf(Pair(1, 1), Pair(2, 2), Pair(3, 3))
val line3 = setOf(Pair(2, 2), Pair(3, 3))
/**
 * Given three sets of coordinates representing three lines in a civil engineering project,
 * find the common points between these lines using nested loops and sets.
 *
 * @param line1 set of coordinates representing the first line
 * @param line2 set of coordinates representing the second line
 * @param line3 set of coordinates representing the third line
 * @return set of coordinates representing the common points between the three lines
 */
fun findCommonPoints(line1: Set<Pair<Int, Int>>, line2: Set<Pair<Int, Int>>, line3: Set<Pair<Int, Int>>): Set<Pair<Int, Int>> {
/**
 * Given three sets of coordinates representing three lines in a civil engineering project,
 * find the common points between these lines using nested loops and sets.
 *
 * @param line1 set of coordinates representing the first line
 * @param line2 set of coordinates representing the second line
 * @param line3 set of coordinates representing the third line
 * @return set of coordinates representing the common points between the three lines
 */
fun findCommonPoints(line1: Set<Pair<Int, Int>>, line2: Set<Pair<Int, Int>>, line3: Set<Pair<Int, Int>>): Set<Pair<Int, Int>> {

    val commonPoints = mutableSetOf<Pair<Int, Int>>()

    // Iterate through the coordinates of line1
    for (point1 in line1) {
        // Iterate through the coordinates of line2
        for (point2 in line2) {
            // Iterate through the coordinates of line3
            for (point3 in line3) {
                // Check if the three points have the same coordinates
                if (point1 == point2 && point2 == point3) {
                    // Add the common point to the set
                    commonPoints.add(point1)
                }
            }
        }
    }

    return commonPoints
}

// Example usage
val line1 = setOf(Pair(0, 0), Pair(1, 1), Pair(2, 2))
val line2 = setOf(Pair(1, 1), Pair(2, 2), Pair(3, 3))
val line3 = setOf(Pair(2, 2), Pair(3, 3))