No submission language available for this problem.
Description
A cubic lattice L in 3-dimensional euclidean space is a set of points defined in the following way: L={u⋅r1+v⋅r2+w⋅r3}u,v,w∈Z Where r1,r2,r3∈Z3 are some integer vectors such that:
r1, r2 and r3 are pairwise orthogonal: r1⋅r2=r1⋅r3=r2⋅r3=0 Where a⋅b is a dot product of vectors a and b.
r1, r2 and r3 all have the same length: ∣r1∣=∣r2∣=∣r3∣=r
You're given a set A={a1,a2,…,an} of integer points, i-th point has coordinates ai=(xi;yi;zi). Let gi=gcd(xi,yi,zi). It is guaranteed that gcd(g1,g2,…,gn)=1.
You have to find a cubic lattice L such that A⊂L and r is the maximum possible.
First line contains single integer n (1≤n≤104) — the number of points in A.
The i-th of the following n lines contains integers xi, yi, zi (0<xi2+yi2+zi2≤1016) — coordinates of the i-th point.
It is guaranteed that gcd(g1,g2,…,gn)=1 where gi=gcd(xi,yi,zi).
In first line output a single integer r2, the square of maximum possible r.
In following 3 lines output coordinates of vectors r1, r2 and r3 respectively.
If there are multiple possible answers, output any.
Input
First line contains single integer n (1≤n≤104) — the number of points in A.
The i-th of the following n lines contains integers xi, yi, zi (0<xi2+yi2+zi2≤1016) — coordinates of the i-th point.
It is guaranteed that gcd(g1,g2,…,gn)=1 where gi=gcd(xi,yi,zi).
Output
In first line output a single integer r2, the square of maximum possible r.
In following 3 lines output coordinates of vectors r1, r2 and r3 respectively.
If there are multiple possible answers, output any.