#include <bits/stdc++.h>
#include<cmath>
#define USE_MATH_DEFINES 
#define inf 1e9
#define N 100010
#define ll long long
#define sf scanf
#define pf printf 
#define mem(a,b) memset(a,b,sizeof(a))
#define open(x) freopen(x ".in", "r", stdin);freopen(x ".out", "w", stdout)
using namespace std;


struct Point{
	double x, y;
	Point() {x = 0, y = 0;}
	Point(double x, double y){
		this->x = x;
		this->y = y;
	}
	Point operator -(const Point b)const{
		return Point(x - b.x, y - b.y);
	}
	Point rotate(Point p, double angle){
		Point v = (*this) - p;
		double c = cos(angle), s = sin(angle);
		return Point(p.x + v.x * c - v.y*s, p.y + v.x*s + v.y*c);
	}
	void print(){printf("%lf %lf\n", x, y);}
}P, O, ans;

int T;
double X, Y, X1, Y1;
int k, m;

int main() {
	sf("%d", &T);
	while(T--){
		scanf("%lf %lf %lf %lf", &X, &Y, &X1, &Y1);
		sf("%d %d", &k, &m);
		
		Point O(X, Y), P(X1, Y1), ans(0, 0);
		
		
		ans = P.rotate(O, -1.00 * (2.00* M_PI)/(double)k * (double)m);
		pf("%lf %lf\n", ans.x, ans.y);
	}
	
	return 0;
}