// Problem: B. Find The Array
// Contest: Codeforces - Educational Codeforces Round 100 (Rated for Div. 2)
// URL: https://codeforces.com/problemset/problem/1463/B
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// 2022-02-22 15:43:50
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define mp make_pair
const ll mod = 1e9 + 7;
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
void solve() {
int n;
cin >> n;
vector<int> a(n + 1, 0) ;
ll s = 0;
ll cnt = 0;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
s += a[i];
if (i & 1) cnt += a[i];
}
if (cnt < s - cnt) {
rep(i, 1, n)
if (i & 1) cout << "1" << " ";
else cout << a[i] << " ";
puts("");
}
else {
rep(i, 1, n)
if (i & 1) cout << a[i] << " ";
else cout << "1 ";
puts("");
}
}
int main () {
int t;
t =1;
cin >> t;
while (t --) solve();
return 0;
}
将数组分为两堆,下标为奇数的,和为偶数的 然后总有一堆是cnt < s - cnt; cnt < s / 2 cnt * 2 < s 这样就能构造一个解,我在想对于a[i] % a[i + 1] , a[i + 1] % a[i]不成立的时候,这个数字设成2 * a[i],还是别的。 事实我们可以用一个显然的解1来处理