/*
hdu 2857 Mirror and Light
计算几何
镜面反射
*/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
const double DNF=100000001.0;
int t;
double x1,x2,y11,y2,xs,ys,xe,ye;
struct Point
{
double x;
double y;
};
struct Line
{
double a;
double b;
double c;
};
Point get_point1(Line x,Line y)
{
return (Point){ (x.b*y.c-y.b*x.c)/(x.a*y.b-y.a*x.b) , (y.a*x.c-x.a*y.c)/(x.a*y.b-y.a*x.b) };
}
Point extent1(Point a,Point b)
{
return (Point){2*b.x-a.x,2*b.y-a.y};
}
Line get_line1(Point a,Point b)
{
return (Line){ a.y-b.y , b.x-a.x , a.y*(a.x-b.x)-a.x*(a.y-b.y) };
}
Line get_line1(Point a,Line x)
{
return (Line){ -x.b , x.a , x.b*a.x-x.a*a.y };
}
int main()
{
//freopen("1005.in","r",stdin);
scanf("%d",&t);
Point ans;
Point s,e,tmp,m1,m2,news;
Line a,b,c;
while(t--)
{
scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y11,&x2,&y2,&xs,&ys,&xe,&ye);
m1.x=x1;m1.y=y11;
m2.x=x2;m2.y=y2;
s=(Point){xs,ys},e=(Point){xe,ye};
//get
b=get_line1(m1,m2);
a=get_line1(s,b);
tmp=get_point1(a,b);
news=extent1(s,tmp);
c=get_line1(news,e);
ans=get_point1(c,b);
if(fabs(ans.x-0.000)<1e-6)
ans.x=0.000;
if(fabs(ans.y-0.000)<1e-6)
ans.y=0.000;
printf("%.3lf %.3lf\n",ans.x,ans.y);
}
return 0;
}