#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 100000, M = 1000000007;
int t, n, ans[N];
pair<int, int> a[N];

int solve(int x, int i) {
	int ret;
	if (i != n - 1) ret = (x + a[n - 1].first) % M;
	else		    ret = (x + a[n - 2].first) % M;
	int idx = upper_bound(a, a + n, make_pair(M - 1 - x, 1000000000)) - a;
	if (idx > 0 && idx < n) {
		if (i != idx - 1)      ret = max(ret, (x + a[idx - 1].first) % M);
		else if (idx - 2 >= 0) ret = max(ret, (x + a[idx - 2].first) % M);
	}
	return ret;
}

int main() {
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		for (int i = 0; i < n; ++i) {
			scanf("%d", &a[i].first);
			a[i].second = i;
		}
		sort(a, a + n);
		for (int i = 0; i < n; ++i)
			ans[a[i].second] = solve(a[i].first, i);
		printf("%d", ans[0]);
		for (int i = 1; i < n; ++i)
			printf(" %d", ans[i]);
		puts("");
	}
	return 0;
}