import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.complex; void main() { auto n = readln.chomp.to!int; foreach (_; 0..n) { auto rd = readln.splitter; auto t = rd.front.to!int; rd.popFront(); auto p = rd.front.to!real; rd.popFront(); auto w = rd.front.to!real; rd.popFront(); auto v = rd.front.to!real; rd.popFront(); auto gx = rd.front.to!real; rd.popFront(); auto gy = rd.front.to!real; rd.popFront(); calc(t, p, w, v, gx, gy); } } auto calc(int t, real p, real w, real v, real gx, real gy) { auto g = complex(gx, gy), e = complex(1+v, w); auto b = g - e ^^ t; auto a = new Complex!real[](t); foreach (i; 0..t) a[i] = e ^^ (t-i-1); auto d = a.map!(ai => ai.sqAbs).sum; foreach (i; 0..t) { auto u = a[i].conj / d * b; writefln("%.15f %.15f", u.re, u.im); } }