#include #include #include #include #include #include #include #include using namespace std; #define int long long #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--) #define REP(i, n) for(int i=0; i<(n); i++) #define RREP(i, n) for(int i=(n-1); i>=0; i--) #define ALL(a) (a).begin(),(a).end() #define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end()); #define CONTAIN(a, b) find(ALL(a), (b)) != (a).end() #define array2(type, x, y) array, x> #define vector2(type) vector > #define out(...) //printf(__VA_ARGS__) typedef pair pos; int pos::*x = &pos::first; int pos::*y = &pos::second; int dxy[] = {0, 1, 0, -1, 0}; /*================================*/ pos p1, p2, p3; int len2(pos p1, pos p2) { return pow(p1.*x - p2.*x, 2) + pow(p1.*y - p2.*y, 2); } signed main() { cin >> p1.*x >> p1.*y >> p2.*x >> p2.*y >> p3.*x >> p3.*y; int len12 = len2(p1, p2); int len23 = len2(p2, p3); int len31 = len2(p1, p3); pos center, h1, h2; if (len12 == len23) { // 中心: 2 center = p2; h1 = p1; h2 = p3; } else if (len23 == len31) { // 中心: 3 center = p3; h1 = p1; h2 = p2; } else if (len31 == len12) { // 中心: 1 center = p1; h1 = p3; h2 = p2; } else { // 正方形にならない場合 cout << -1 << endl; return 0; } // 90°じゃない場合...? pos p4, vec, vec2; vec.*x = h1.*x - center.*x; vec.*y = h1.*y - center.*y; vec2.*x = h2.*x - center.*x; vec2.*y = h2.*y - center.*y; if (vec2.*x * vec.*x + vec2.*y * vec.*y != 0) { // 内積が0でない: 90°じゃない cout << -1 << endl; return 0; } p4.*x = h2.*x + vec.*x; p4.*y = h2.*y + vec.*y; cout << p4.*x << " " << p4.*y << endl; return 0; }