import java.math.BigInteger

data class Rational(val numerator: BigInteger, val denominator: BigInteger): Comparable<Rational> {
    override fun compareTo(other: Rational): Int = (numerator * other.denominator).compareTo(denominator * other.denominator)
    operator fun plus(that: Rational): Rational = Rational.new(numerator * that.denominator + denominator * that.numerator, denominator * that.denominator)
    operator fun minus(that: Rational): Rational = Rational.new(numerator * that.denominator - denominator * that.numerator, denominator * that.denominator)
    operator fun times(that: Rational): Rational = Rational.new(numerator * that.numerator, denominator * that.denominator)
    operator fun div(that: Rational): Rational = Rational.new(numerator * that.denominator, denominator * that.numerator)
    operator fun unaryMinus():Rational = Rational(-numerator, denominator)
    companion object {
        fun new(numerator: BigInteger, denominator: BigInteger): Rational {
            val g = gcd(numerator.abs(), denominator.abs())
            return Rational(numerator * denominator.signum().toBigInteger() / g, denominator.abs() / g)
        }
        fun new(number: Int): Rational = Rational(number.toBigInteger(), 1.toBigInteger())
        tailrec fun gcd(a: BigInteger, b: BigInteger): BigInteger {
            return if (b == 0.toBigInteger()){
                a
            }else {
                gcd(b, a % b)
            }
        }
    }
}
fun Int.toRational(): Rational = Rational.new(this)
fun Int.toBigInteger(): BigInteger = BigInteger.valueOf(this.toLong())

data class Point(val x: Rational, val y: Rational) {
    operator fun plus(that: Point): Point = Point(x + that.x, y + that.y)
    operator fun plus(that: Vector): Point = Point(x + that.x, y + that.y)
    operator fun minus(that: Point): Vector = Vector(x - that.x, y - that.y)
    constructor(x: Int, y: Int):this(Rational.new(x), Rational.new(y))
}
data class Vector(val x: Rational, val y: Rational)
class Line private constructor(private val a: Rational, private val b: Rational, private val c: Rational) {
    fun cathetus(point: Point): Line = Line(b, -a, a * point.y - b * point.x)
    fun isParallel(that: Line): Boolean = a * that.b == b * that.a
    fun crossPoint(that: Line): Point? = if (isParallel(that)) null else (a * that.b - b * that.a).let{d -> Point((b * that.c - c * that.b) / d, (c * that.a - a * that.c) / d)}
    fun symmetryPoint(point: Point): Point = (crossPoint(cathetus(point))!! - point).let{vec -> point + vec + vec}
    fun isOnLine(that: Point): Boolean = a * that.x + b * that.y + c == 0.toRational()
    companion object {
        fun byTwoPoints(a: Point, b: Point): Line = Line(a.y - b.y, b.x - a. x, a.x * b.y - a.y * b.x)
    }
}
fun isOnLine(points: Array<Point>): Boolean {
    val line = Line.byTwoPoints(points[0], points[1])
    return (2 until points.size).all{line.isOnLine(points[it])}
}
fun main(args: Array<String>?): Unit {
    val n = readLine()!!.trim().toInt()
    val points = Array(n){
        val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
        Point(x, y)
    }
    if (isOnLine(points)) {
        println("No")
        return
    }
    val set = points.toHashSet()
    var isSymmetry = false
    for (p in 0 .. 1) {
        for (i in p + 1 until n ){
            if (isSymmetry) {
                println("Yes")
                return
            }
            val midLine = Line.byTwoPoints(points[p], points[i]).cathetus(Point((points[p].x + points[i].x) / 2.toRational(), (points[p].y + points[i].y) / 2.toRational()))
            isSymmetry = true
            var onLineCount = 0
            for (j in 0 until n) {
                if (i != j && midLine.isOnLine(points[j])) {
                    ++onLineCount
                }
                if (i != j && (onLineCount > 2 || midLine.symmetryPoint(points[j]) !in set)) {
                    isSymmetry = false
                    break
                }
            }
        }
    }
    for (i in 1 until n){
        if (isSymmetry){
            println("Yes")
            return
        }
        val midLine = Line.byTwoPoints(points[0], points[i])
        isSymmetry = true
        for (j in 1 .. n){
            if (i != j && (midLine.isOnLine(points[j]) || midLine.symmetryPoint(points[j]) !in set)) {
                isSymmetry = false
                break
            }
        }
    }
    println("No")
}


Measured memory_bytes: 109104