import scala.math._ object Main { class Vec(val x: Int, val y: Int) { def mag(): Double = sqrt(magSq()) def magSq(): Int = x * x + y * y def dot(o: Vec): Int = x * o.x + y * o.y def cross(o: Vec): Int = x * o.y - y * o.x def +(o: Vec): Vec = new Vec(x + o.x, y + o.y) def -(o: Vec): Vec = new Vec(x - o.x, y - o.y) } def calc(a: Vec, b: Vec, c: Vec) { Array(a, b, c).permutations.foreach { case Array(a, b, c) => val ab = b - a val ac = c - a // ベクトル ab, ac の内積がゼロなら直交している if (ab.dot(ac) == 0 && ab.magSq == ac.magSq) { val ad = ab + ac val d = ad + a val cd = d - c if (ac.magSq == cd.magSq) { println(s"${d.x} ${d.y}") return } } } println(-1) // not found } def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val x1, y1, x2, y2, x3, y3 = sc.nextInt calc(new Vec(x1, y1), new Vec(x2, y2), new Vec(x3, y3)) } }