#include <bits/stdc++.h>↵
using namespace std;↵
typedef vector<int> vi;↵
void solve()↵
{↵
int n; cin>>n;↵
vi v(n); ↵
for(int i=0;i<n;i++)cin>>v[i];↵
↵
vi ans(n+1,0);↵
↵
for(int i=0;i<n;i++)↵
{↵
ans[i] = 1e9;↵
for(int j=i-1;j>=0;j--)↵
{↵
if(ans[i]<i-j)↵
break;↵
↵
ans[i] = min(ans[i],abs(v[i]-v[j])+(abs(i-j)));↵
}↵
↵
for(int j=i+1;j<n;j++)↵
{↵
if(ans[i] < j-i)↵
{↵
break;↵
}↵
↵
ans[i] = min(ans[i],abs(v[i]-v[j])+abs(i-j));↵
}↵
↵
cout<<ans[i]<<" ";↵
}↵
}↵
signed main()↵
{↵
int T;↵
T=1;↵
cin>>T;↵
while(T--)↵
{↵
solve();↵
}↵
}
using namespace std;↵
typedef vector<int> vi;↵
void solve()↵
{↵
int n; cin>>n;↵
vi v(n); ↵
for(int i=0;i<n;i++)cin>>v[i];↵
↵
vi ans(n+1,0);↵
↵
for(int i=0;i<n;i++)↵
{↵
ans[i] = 1e9;↵
for(int j=i-1;j>=0;j--)↵
{↵
if(ans[i]<i-j)↵
break;↵
↵
ans[i] = min(ans[i],abs(v[i]-v[j])+(abs(i-j)));↵
}↵
↵
for(int j=i+1;j<n;j++)↵
{↵
if(ans[i] < j-i)↵
{↵
break;↵
}↵
↵
ans[i] = min(ans[i],abs(v[i]-v[j])+abs(i-j));↵
}↵
↵
cout<<ans[i]<<" ";↵
}↵
}↵
signed main()↵
{↵
int T;↵
T=1;↵
cin>>T;↵
while(T--)↵
{↵
solve();↵
}↵
}