#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; struct Vec { using etype = long long; // type of elements using ptype = long long; // type of product results etype x = 0, y = 0; constexpr Vec operator-() const { return {-x, -y}; } friend constexpr Vec operator+(const Vec& a, const Vec& b) { return {a.x + b.x, a.y + b.y}; } friend constexpr Vec operator-(const Vec& a, const Vec& b) { return {a.x - b.x, a.y - b.y}; } friend constexpr ptype operator*(const Vec& a, const Vec& b) { return (ptype)a.x * b.y - (ptype)a.y * b.x; } template >* = nullptr> friend constexpr Vec operator*(T c, const Vec& a) { return {c * a.x, c * a.y}; } template >* = nullptr> friend constexpr Vec operator*(const Vec& a, T c) { return c * a; } template >* = nullptr> friend constexpr Vec operator/(const Vec& a, T c) { return {a.x / c, a.y / c}; } Vec& operator+=(const Vec& a) { x += a.x; y += a.y; return *this; } Vec& operator-=(const Vec& a) { x -= a.x; y -= a.y; return *this; } template >* = nullptr> Vec& operator*=(T c) { x *= c; y *= c; return *this; } friend constexpr bool operator==(const Vec& a, const Vec& b) { return a.x == b.x && a.y == b.y; } friend constexpr bool operator!=(const Vec& a, const Vec& b) { return !(a == b); } constexpr int quadrant() const { return y > 0 ? (x > 0 ? 0 : 1) : y < 0 ? (x < 0 ? 2 : 3) : (x > 0 ? 0 : x < 0 ? 2 : -1); } friend constexpr bool operator<(const Vec& a, const Vec& b) { int qa = a.quadrant(), qb = b.quadrant(); if (qa != qb) return qa < qb; ptype p1 = (ptype)a.x * b.y, l2 = (ptype)a.y * b.x; return p1 > l2 || (p1 == l2 && (a.x != 0 ? abs(a.x) < abs(b.x) : abs(a.y) < abs(b.y))); } friend constexpr bool operator>(const Vec& a, const Vec& b) { return b < a; } friend constexpr bool operator<=(const Vec& a, const Vec& b) { return !(b < a); } friend constexpr bool operator>=(const Vec& a, const Vec& b) { return !(a < b); } constexpr int ccw(const Vec& u, const Vec& v) const { ptype p = (u - *this) * (v - *this); return p > 0 ? 1 : p < 0 ? -1 : 0; } static constexpr bool intersects(const Vec& a, const Vec& b, const Vec& c, const Vec& d) { return a.ccw(b, c) * a.ccw(b, d) <= 0 && c.ccw(d, a) * c.ccw(d, b) <= 0; } constexpr bool parallel_to(const Vec& a) const { return (ptype)x * a.y == (ptype)y * a.x; } constexpr ptype dot(const Vec& a) const { return (ptype)x * a.x + (ptype)y * a.y; } constexpr ptype norm2() const { return (ptype)x * x + (ptype)y * y; } constexpr bool is_zero() const { return x == 0 && y == 0; } constexpr Vec normalize() const { if (x == 0) return Vec{0, (y == 0 ? 0 : 1)}; etype g = gcd(x, y); return *this / (x > 0 ? g : -g); } constexpr Vec rot90() const { return {-y, x}; } // exclusive constexpr bool in_between(const Vec& a, const Vec& b) const { Vec x = a - *this, y = b - *this; return x.parallel_to(y) && x.dot(y) < 0; } friend std::ostream& operator<< (std::ostream& os, const Vec& t) { return os << t.x << ' ' << t.y; } friend std::istream& operator>> (std::istream& os, Vec& t) { return os >> t.x >> t.y; } }; } int main() { ios::sync_with_stdio(false); cin.tie(0); Vec a, b, c; cin >> a >> b >> c; a *= 4; b *= 4; c *= 4; if (a == b || b == c || c == a) { cout << -1 << '\n'; return 0; } constexpr int INF = 1001001001; auto f = [&](Vec a, Vec b, Vec c) { bool xflip = a.x > b.x; bool yflip = a.y > b.y; if (xflip) a.x *= -1, b.x *= -1, c.x *= -1; if (yflip) a.y *= -1, b.y *= -1, c.y *= -1; int dx = b.x - a.x, dy = b.y - a.y; bool dflip = dx > dy; if (dflip) swap(dx, dy), swap(a.x, a.y), swap(b.x, b.y), swap(c.x, c.y); int d = (dx + dy) / 2; Vec u = {a.x, a.y + d}, v = {b.x, b.y - d}; vector> res; res.emplace_back(u, v); res.emplace_back(Vec{-INF, u.y}, u); res.emplace_back(Vec{INF, v.y}, v); if (dx == dy) { if (!(a.x <= c.x && c.x <= b.x && a.y <= c.y && c.y <= b.y)) { cout << -1 << '\n'; exit(0); } } if (dflip) for (auto& [u, v] : res) swap(u.x, u.y), swap(v.x, v.y); if (yflip) for (auto& [u, v] : res) u.y *= -1, v.y *= -1; if (xflip) for (auto& [u, v] : res) u.x *= -1, v.x *= -1; return res; }; auto s1 = f(a, b, c); auto s2 = f(a, c, b); vector ans; rep(i, ssize(s1)) rep(j, ssize(s2)) { auto [u1,v1] = s1[i]; auto [u2,v2] = s2[j]; auto d1 = u1 - v1; auto d2 = u2 - v2; if (d1 * d2 == 0) { if (d1 == Vec{0, 0}) swap(d1, d2); if (d1 == Vec{0, 0}) { if (u1 == u2) ans.emplace_back(u1); continue; } auto h = d1.rot90(); if (u1.dot(h) != u2.dot(h)) continue; ll l1 = d1.dot(u1), r1 = d1.dot(v1); ll l2 = d1.dot(u2), r2 = d1.dot(v2); if (l1 > r1) swap(l1, r1); if (l2 > r2) swap(l2, r2); if (max(l1, l2) < min(r1, r2)) { cout << -1 << '\n'; return 0; } rep(_, 2) { rep(_, 2) { if (u1 == u2) ans.emplace_back(u1); swap(u2, v2); } swap(u1, v1); } } else { ll x1 = (ll)u1.y * 1 - (ll)1 * v1.y; ll y1 = (ll)1 * v1.x - (ll)u1.x * 1; ll z1 = (ll)u1.x * v1.y - (ll)u1.y * v1.x; ll g = gcd(gcd(x1, y1), z1); x1 /= g, y1 /= g, z1 /= g; ll x2 = (ll)u2.y * 1 - (ll)1 * v2.y; ll y2 = (ll)1 * v2.x - (ll)u2.x * 1; ll z2 = (ll)u2.x * v2.y - (ll)u2.y * v2.x; g = gcd(gcd(x2, y2), z2); x2 /= g, y2 /= g, z2 /= g; ll x = (ll)y1 * z2 - (ll)z1 * y2; ll y = (ll)z1 * x2 - (ll)x1 * z2; ll z = (ll)x1 * y2 - (ll)y1 * x2; g = gcd(gcd(x, y), z); x /= g; y /= g; z /= g; if (z < 0) x *= -1, y *= -1, z *= -1; assert(z == 1); Vec p{x, y}; bool ok = true; rep(_, 2) { ll l = u1.dot(d1), r = v1.dot(d1); if (l > r) swap(l, r); ll t = p * d1; ok &= l <= t && t <= r; swap(u1, u2); swap(v1, v2); } if (ok) ans.emplace_back(p); } } sort(all(ans)); ans.erase(unique(all(ans)), ans.end()); cout << ans.size() << '\n'; for (auto [x, y] : ans) { cout << x / 4.0 << ' ' << y / 4.0 << '\n'; } }