Problem: On a strip of land of length n there are k air conditioners: the i-th air conditioner is placed in cell a_i (1 ≤ a_i ≤ n). Two or more air conditioners cannot be placed in the same cell (i.e. all a_i are distinct).

Each air conditioner is characterized by one parameter: temperature. The i-th air conditioner is set to the temperature t_i.

<image> Example of strip of length n=6, where k=2, a=[2,5] and t=[14,16].

For each cell i (1 ≤ i ≤ n) find it's temperature, that can be calculated by the formula $$$min_{1 ≤ j ≤ k}(t_j + |a_j - i|),$$$

where |a_j - i| denotes absolute value of the difference a_j - i.

In other words, the temperature in cell i is equal to the minimum among the temperatures of air conditioners, increased by the distance from it to the cell i.

Let's look at an example. Consider that n=6, k=2, the first air conditioner is placed in cell a_1=2 and is set to the temperature t_1=14 and the second air conditioner is placed in cell a_2=5 and is set to the temperature t_2=16. In that case temperatures in cells are:

  1. temperature in cell 1 is: min(14 + |2 - 1|, 16 + |5 - 1|)=min(14 + 1, 16 + 4)=min(15, 20)=15; 
  2. temperature in cell 2 is: min(14 + |2 - 2|, 16 + |5 - 2|)=min(14 + 0, 16 + 3)=min(14, 19)=14; 
  3. temperature in cell 3 is: min(14 + |2 - 3|, 16 + |5 - 3|)=min(14 + 1, 16 + 2)=min(15, 18)=15; 
  4. temperature in cell 4 is: min(14 + |2 - 4|, 16 + |5 - 4|)=min(14 + 2, 16 + 1)=min(16, 17)=16; 
  5. temperature in cell 5 is: min(14 + |2 - 5|, 16 + |5 - 5|)=min(14 + 3, 16 + 0)=min(17, 16)=16; 
  6. temperature in cell 6 is: min(14 + |2 - 6|, 16 + |5 - 6|)=min(14 + 4, 16 + 1)=min(18, 17)=17. 



For each cell from 1 to n find the temperature in it.

Input

The first line contains one integer q (1 ≤ q ≤ 10^4) — the number of test cases in the input. Then test cases follow. Before each test case, there is an empty line.

Each test case contains three lines. The first line contains two integers n (1 ≤ n ≤ 3 ⋅ 10^5) and k (1 ≤ k ≤ n) — the length of the strip of land and the number of air conditioners respectively.

The second line contains k integers a_1, a_2, …, a_k (1 ≤ a_i ≤ n) — positions of air conditioners on the strip of land.

The third line contains k integers t_1, t_2, …, t_k (1 ≤ t_i ≤ 10^9) — temperatures of air conditioners.

It is guaranteed that the sum of n over all test cases does not exceed 3 ⋅ 10^5.

Output

For each test case output n integers separated by space: temperatures of air in cells.

Example

Input


5

6 2
2 5
14 16

10 1
7
30

5 5
3 1 4 2 5
3 1 4 2 5

7 1
1
1000000000

6 3
6 1 3
5 5 5


Output


15 14 15 16 16 17 
36 35 34 33 32 31 30 31 32 33 
1 2 3 4 5 
1000000000 1000000001 1000000002 1000000003 1000000004 1000000005 1000000006 
5 6 5 6 6 5 

Solution (in CPP):

Solution:
//Written by : Atharva Kulkarni (Naruto_cm)

#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef std::vector<ll> vll;
typedef std::vector<pll> vpll;
typedef std::vector<vll> vvll;
typedef map<ll,ll>mll;
typedef map<ll,pll>mpll;
typedef set<ll> sll;

//USEFUL MACROS
#define test            ll t;cin>>t;while(t--)
#define in(n)          ll n;cin>>n;
#define inp(a,n)        vll a(n);for(ll i = 0;i<n;i++) cin>>a[i];
#define inp1(a,n)        vll a(n+1);a[0] = 0;for(ll i = 1;i<=n;i++) cin>>a[i];
#define sz(a)           ll(a.size())
#define nl              cout<<endl;
#define F               first
#define S               second
#define pb              push_back
#define mod             1000000007
#define mod1            998244353
#define inf             1e18
#define dec(x)         cout<<fixed<<setprecision(x)<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vec(a)          (a).begin(),(a).end()
#define sortvec(a)    sort(vec(a),greater<ll>())
#define minVec(a)       *min_element(vec(a))
#define maxVec(a)       *max_element(vec(a))
#define inpstr(s)      string s;cin>>s; 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//USEFUL FUNCTIONS
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
bool isPrime(ll n){if(n <= 1)return false;if(n <= 3)return true;if(n%2 == 0 || n%3 == 0)return false;for(ll i=5; i*i<=n; i=i+6)if(n%i == 0 || n%(i+2) == 0)return false;return true;}
ll nextPrime(ll N){if(N<=1)return 2;ll prime = N;bool found = false;while(!found){prime++;if(isPrime(prime))found=true;}return prime;}
ll cl(ll n,ll d){return (n+d-1)/d;} 
ll binToDec(string s){return bitset<64>(s).to_ullong();}
string decToBin(ll a){return bitset<64>(a).to_string();}
ll gcd(ll a, ll b) {if (b == 0)return a; return gcd(b, a % b);}
ll lcm(ll a,ll b){return (a*b)/(gcd(a,b));}
void print(pll a){cout<<a.F<<' '<<a.S;nl;}
void print(ll a){cout<<a;nl}
void print(vll a){for(auto i : a)cout<<i<<' ';nl;}
void print(string s){cout<<s;nl;}
void printr(vll a,ll start,ll end){for(ll i =start;i<end;i++)cout<<a[i]<<' ';nl;}
void print(ll a,ll b){cout<<a<<' '<<b;}
void amax(ll &a, ll b){a=max(a,b);}
void amin(ll &a, ll b){a=min(a,b);}
ll madd(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
ll mmul(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
ll msub(ll a,ll b){return ((a%mod)-(b%mod)+mod)%mod;}
ll fpow(ll x,ll y,ll p=mod){x%=p;ll sum = 1;while(y){if (y & 1)sum = sum * x; sum %= p; y = y >> 1; x = x * x; x %= p;} return sum;}
bool isPerSquare(long double a) {if(a<0) return false; ll sr = sqrt(a); return (sr*sr == a);}
bool isPalindrome(string str){ll low = 0,high = sz(str) - 1;while (low < high){if (str[low] != str[high])return false;low++,high--;}return true;}



void solve(){
    in(n);in(k);
    inp(a,k);
    inp(t,k);
    vpll vp;
    for(ll i = 0;i<k;i++){
        vp.pb({a[i],t[i]});
    }
    sort(vp.begin(),vp.end());
    vll left(n+1),right(n+2);
    left[0] = inf;
    ll j = 0;
    for(ll i = 0;i<n;i++){
        if(j<sz(vp) && i+1 == vp[j].F)left[i+1] = min(left[i],vp[j].S - vp[j].F),j++;
        else left[i+1] = left[i];
    }
    j = 1;
    ll rev = sz(vp)-1;
    right[n+1] = inf;
    for(ll i = n-1;i>=0;i--){
        if(rev>=0 && i+1 == vp[rev].F)right[i + 1] = min(right[i+2],vp[rev].S + vp[rev].F),rev--;
        else right[i+1] = right[i+2];
    }

    vll ans(n);
    for(ll i = 0;i<n;i++){
        ans[i] = min(left[i+1] + i + 1,right[i+1] - i  - 1);
    }
    print(ans);
}



signed main()
{ 
    FIO;
    test
        solve();
}
//Girne se darega toa udaan kaise bharega
//Aur ye jindagi h meri jaan mehnat nhi krega toa aage kaise badhega
//Naruto_cm