#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--){
        int n;
        cin >> n;
        vector<int> a(n);
        for(auto &it:a){
            cin >> it;
        }
        vector<int> b(n);
        int base = 1e9+5;
        for(auto i = 0; i < n; ++i){
            base = min(base, a[i]);
        }
        for(auto i = 0; i < n; ++i){
            b[i] = base;
            while(b[i] * 2 < a[i]){
                b[i] *= 2;
            }
        }
        for(auto i = 0; i < n; ++i){
            if(i > 0){
                cout << " ";
            }
            cout << b[i];
        }
        cout << endl;
    }
}
