#include using namespace std; using ld = double; constexpr ld PI = static_cast(3.1415926535897932384626433832795); struct Vec { Vec() : dx{0}, dy{0} {} Vec(const ld dx, const ld dy) : dx{dx}, dy{dy} {} ld dx; ld dy; Vec rotate(const ld theta) const { Vec ans; ans.dx = cos(theta) * dx - sin(theta) * dy; ans.dy = sin(theta) * dx + cos(theta) * dy; return ans; } Vec operator*(const ld x) const { Vec ans = *this; ans.dx *= x; ans.dy *= x; return ans; } ld norm() const { return hypot(dx, dy); } }; int main() { int N; cin >> N; for (int q = 0; q < N; q++) { int T; cin >> T; ld p, omega, v, gx, gy; cin >> p >> omega >> v >> gx >> gy; if (omega == 0 and v == -1) { for (int i = 0; i < T; i++) { if (i == T - 1) { cout << fixed << setprecision(40) << gx << " " << gy << endl; } else { cout << fixed << setprecision(40) << 0 << " " << 0 << endl; } } } else { const ld l = hypot(omega, (ld)(1 + v)); const ld theta = arg(complex{(ld)(1 + v), omega}); Vec g{gx - pow(l, T) * cos((ld)T * theta), gy - pow(l, T) * sin((ld)T * theta)}; // ld F = 0; // for (int i = 0; i < T; i++) { // if (l < 1) { // F += pow(l, 2 * T - 2 - 2 * i); // } else { // F += pow(l, 2 * i); // } // } const ld F = (l == 1 ? 2 * T : (pow(l, 2 * T) - 1) / (l * l - 1)); for (int i = 0; i < T; i++) { const Vec v = g.rotate(theta * (ld)(i + 1 - T)) * (pow(l, T - 1 - i) / F); cout << fixed << setprecision(40) << (long double)v.dx << " " << (long double)v.dy << endl; } } } return 0; }