#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#define inf 0x3f3f3f3f
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define mst(x) memset(x,0,sizeof(x))
#define mstinf(x) memset(x,0x3f,sizeof(x))
#define IOS ios::sync_with_stdio(false);
#define outm(marname,x,y) for(int i = 0;i < x;++i){ for(int j = 1;j < y ;++j) { cout << marname[i][j] << ' ';}cout << endl;}
#define outa(arrname,len) for(int i = 0;i < len;++i) cout << arrname[i] << ' ';
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
int n;
int len;
vector<int> a[105];
int rem[105];
int zhijing;
int bfs(int s){
    zhijing = 0;
    queue<int> h1,h2;
    h1.push(s);
    int ret = -1;
    while(h1.size()+h2.size()){

        if(h1.size()){
            zhijing++;
            while(h1.size()){
                int t = h1.front();
                ret = t;
                h1.pop();
                for(int i = 0 ; i < a[t].size() ; ++i){
                    if(rem[a[t][i]] == 0){
                        h2.push(a[t][i]);
                        rem[a[t][i]] = 1;
                    }
                }
            }
        }
        if(h2.size()){
            zhijing++;
            while(h2.size()){
                int t = h2.front();
                ret = t;
                h2.pop();
                for(int i = 0 ; i < a[t].size() ; ++i){
                    if(rem[a[t][i]] == 0){
                        h1.push(a[t][i]);
                        rem[a[t][i]] = 1;
                    }
                }
            }
        }
    }
    return ret;
}
void getzhijing(){
    zhijing = 0;
    int s = bfs(1);
    mst(rem);
    bfs(s);
    return ;
}
int main(){
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        int num;
        cin >> num;
        for(int j = 0 ; j < num-1 ;++j){
            int c,b;
            cin >> c >> b;
            a[c].push_back(b);
            a[b].push_back(c);
        }
        if(num == 2){
            len++;
        }else{
            getzhijing();
            len += zhijing-1;
        }
        mst(rem);
        for(int i = 0 ; i < 105 ;++i){
            a[i].clear();
        }
    }
    cout << len;
    return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#define inf 0x3f3f3f3f
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define mst(x) memset(x,0,sizeof(x))
#define mstinf(x) memset(x,0x3f,sizeof(x))
#define IOS ios::sync_with_stdio(false);
#define outm(marname,x,y) for(int i = 0;i < x;++i){ for(int j = 1;j < y ;++j) { cout << marname[i][j] << ' ';}cout << endl;}
#define outa(arrname,len) for(int i = 0;i < len;++i) cout << arrname[i] << ' ';
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
int n;
int len;
vector<int> a[105];
int rem[105];
int zhijing;
int bfs(int s){
    zhijing = 0;
    queue<int> h1,h2;
    h1.push(s);
    int ret = -1;
    //cout << a[s].size() << '~';
    while(h1.size()+h2.size()){

        if(h1.size()){
            zhijing++;
            while(h1.size()){
                int t = h1.front();
                ret = t;
                rem[t] = 1;
                h1.pop();
                //cout << a[t].size() << '~';
                for(int i = 0 ; i < a[t].size() ; ++i){
                    if(rem[a[t][i]] == 0){
                        h2.push(a[t][i]);
                        rem[a[t][i]] = 1;
                    }
                }
            }
        }
        if(h2.size()){
            zhijing++;
            while(h2.size()){
                int t = h2.front();
                ret = t;
                rem[t] = 1;
                h2.pop();
                for(int i = 0 ; i < a[t].size() ; ++i){
                    if(rem[a[t][i]] == 0){
                        h1.push(a[t][i]);
                        rem[a[t][i]] = 1;
                    }
                }
            }
        }
    }
    //cout << ret << '-' << endl;
    return ret;
}
void getzhijing(){
    mst(rem);
    int s = bfs(1);
    //cout << s << endl << endl;
    mst(rem);
    bfs(s);
    return ;
}
int main(){
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        int num;
        cin >> num;
        for(int j = 0 ; j < num-1 ;++j){
            int c,b;
            cin >> c >> b;
            a[c].push_back(b);
            a[b].push_back(c);
        }
        if(num == 2){
            len++;
        }else{
            getzhijing();
            //cout << zhijing << endl;
            len += zhijing-1;
        }
        mst(rem);
        for(int i = 0 ; i < 105 ;++i){
            a[i].clear();
        }
    }
    cout << len;
    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define N 1007

vector<ll> adj[N];
vector<ll> vis(N),depth(N);
ll maxd = 0;

void dfs(ll node){
	vis[node] = 1;
	// maxd = max(maxd, depth[node]);

	for(auto &x : adj[node]){
		if(!vis[x]){
			depth[x] = depth[node] + 1;
			dfs(x);
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

 	freopen("input.txt", "r" , stdin);
 	freopen("output.txt", "w" , stdout);

   	ll t;
   	cin>>t;

   	ll ans = 0;
   	while(t--){
   		ll n;
   		cin>>n;

   		ll a,b;
   		for(ll i=0;i<n-1;++i){
   			cin>>a>>b;
   			adj[a].emplace_back(b);
   			adj[b].emplace_back(a);
   		}

		dfs(1);
		a = 1;
		maxd = 0;
		for(ll i=1;i<=n;++i)
			if(depth[i] > maxd){
				maxd = depth[i];
				a = i;
			}

		fill(depth.begin(),depth.end(),0);
		fill(vis.begin(),vis.end(),0);

		dfs(a);
		maxd = 0;
		for(ll i=1;i<=n;++i){
			maxd = max(maxd,depth[i]);
		}

   		// cout<<maxd<<"\n";
		ans += maxd;
		maxd = 0;
		for(ll i=1;i<=n;++i)
			adj[i].clear();

		fill(depth.begin(),depth.end(),0);
		fill(vis.begin(),vis.end(),0);

   	}

   	cout<<ans<<"\n";

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define N 1007

vector<ll> adj[N];
vector<ll> vis(N),depth(N);
ll maxd = 0;

void dfs(ll node){
	vis[node] = 1;
	maxd = max(maxd, depth[node]);

	for(auto &x : adj[node]){
		if(!vis[x]){
			depth[x] = depth[node] + 1;
			dfs(x);
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

 	freopen("input.txt", "r" , stdin);
 	freopen("output.txt", "w" , stdout);

   	ll t;
   	cin>>t;

   	ll ans = 0;
   	while(t--){
   		ll n;
   		cin>>n;

   		ll a,b;
   		for(ll i=0;i<n-1;++i){
   			cin>>a>>b;
   			adj[a].emplace_back(b);
   			adj[b].emplace_back(a);
   		}

   		for(ll i=1;i<=n;++i)
   			if(adj[i].size() == 1) {dfs(i); break;}

   		// cout<<maxd<<"\n";
		ans += maxd;
		maxd = 0;
		for(ll i=1;i<=n;++i)
			adj[i].clear();

		fill(depth.begin(),depth.end(),0);
		fill(vis.begin(),vis.end(),0);
   	}

   	cout<<ans<<"\n";

    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define N 1007

vector<ll> adj[N];
vector<ll> vis(N),depth(N);
ll maxd = 0;

void dfs(ll node){
	vis[node] = 1;
	maxd = max(maxd, depth[node]);

	for(auto &x : adj[node]){
		if(!vis[x]){
			depth[x] = depth[node] + 1;
			dfs(x);
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

   	ll t;
   	cin>>t;

   	ll ans = 0;
   	while(t--){
   		ll n;
   		cin>>n;

   		ll a,b;
   		for(ll i=0;i<n-1;++i){
   			cin>>a>>b;
   			adj[a].emplace_back(b);
   			adj[b].emplace_back(a);
   		}

   		for(ll i=1;i<=n;++i)
   			if(adj[i].size() == 1) {dfs(i); break;}

   		// cout<<maxd<<"\n";
		ans += maxd;
		maxd = 0;
		for(ll i=1;i<=n;++i)
			adj[i].clear();

		fill(depth.begin(),depth.end(),0);
		fill(vis.begin(),vis.end(),0);
   	}

   	cout<<ans<<"\n";

    return 0;
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[1005];
ll visit[1005];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a, b;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 1002; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 1002; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[1005];
ll visit[1005];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a = 0; ll b = 0;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 1002; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 1002; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a = 0; ll b = 0;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 102; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 102; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a, b;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 102; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 102; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        ll a = 0; ll b = 0;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 102; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 102; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a, b;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 102; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 102; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[1005];
ll visit[1005];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    ifstream ifs("input.txt");
    ofstream ofs("output.txt");
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                ll a, b;
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 1002; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 1002; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        ll a = 0; ll b = 0;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;
            //cout << maxNode <<" first end of maxnode of " << i << endl;
            for(int i = 0; i < 105; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;

            for(int i = 0; i < 105; i++)
                arr[i].clear();
            for(int i = 0; i < 105; i++)
                visit[i] = 0;
            maxD = -1;
        }
        cout << count << endl;
   }
}


#include <bits/stdc++.h>
#define ll  int
using namespace std;
ll m = 1000000007;
//ll maxx = INT_MIN;
vector<ll> arr[105];
ll visit[105];
ll maxD = -1; ll maxNode;

void dfs(int node, int dist)
{
    visit[node] = 1;
    if(dist > maxD)
    {
        maxD = dist;
        maxNode = node;
    }
    int x = arr[node].size();
    for(int i = 0; i < x; i++)
    {
        if(!visit[arr[node][i]])
        {
            visit[arr[node][i]] = 1;
            dfs(arr[node][i], dist+1);
        }
    }
}

int main()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ll count = 0;
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        ll n;
        cin >> n;
        ll a = 0; ll b = 0;
        for(int i = 0; i < n; i++)
        {
            ll ni;
            cin >> ni;
            for(int j = 0; j < ni-1; j++)
            {
                cin >> a >> b;
                arr[a].push_back(b);
                arr[b].push_back(a);
            }
            dfs(1, 0);
            maxD = -1;

            for(int i = 0; i < 102; i++)
                visit[i] = 0;
            dfs(maxNode, 0);
            count += maxD;
            for(int i = 0; i < 102; i++)
                arr[i].clear();
        }
        cout << count << endl;
   }
}


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

const int N = 1e6 + 10;
int vis[N] , ans = 0 ;
vector <int> nei[N];

int DFS( int x ) {
	vis[x] = 1 ;
	int mx = 0 ;
	for ( auto u : nei[x] ) {
		if ( !vis[u] )
		mx = max( mx , DFS(u) + 1 ) ;
	}
	return mx;
}

void solve() {

	int n; cin >> n;
	for ( int i = 0 ; i < n ; i++ )
	nei[i].clear();

	int u, v;
    for ( int i = 0 ; i < n - 1 ; i++ ) {
    	cin >> u >> v ;
    	nei[u].push_back(v);nei[v].push_back(u);
	}
	int mx = 0 ;
	for ( int i = 0 ; i < n ;i++) {
		memset(vis,0,sizeof vis) ;
		mx = max(mx,DFS(i));
	}
	ans += mx ;
}

int main() {

	int tc ;cin >> tc;
	while(tc--) {
		solve();
	}
	cout << ans ;
}


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

const int N = 1e3 + 10;
int vis[N] , ans = 0 ;
vector <int> nei[N];

int DFS( int x ) {
	vis[x] = 1 ;
	int mx = 0 ;
	for ( auto u : nei[x] ) {
		if ( !vis[u] )
		mx = max( mx , DFS(u) + 1 ) ;
	}
	return mx;
}

int main() {
//	freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
	int tc; cin >> tc;
	while(tc--) {
	int n; cin >> n;
	for ( int i = 0 ; i < n ; i++ )
	nei[i].clear();

	int u, v;
    for ( int i = 0 ; i < n - 1 ; i++ ) {
    	cin >> u >> v ; u--;v--;
    	nei[u].push_back(v);nei[v].push_back(u);
	}
	int mx = 0 ;
	for ( int i = 0 ; i < n ;i++) {
		memset(vis,0,sizeof vis) ;
		mx = max(mx,DFS(i));
	}
	ans += mx ;
}
cout << ans ;
}


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

const int N = 1e3 + 10;
int vis[N] , ans = 0 ;
vector <int> nei[N];

int DFS( int x ) {
	vis[x] = 1 ;
	int mx = 0 ;
	for ( auto u : nei[x] ) {
		if ( !vis[u] )
		mx = max( mx , DFS(u) + 1 ) ;
	}
	return mx;
}

int main() {
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
	int tc; cin >> tc;
	while(tc--) {
	int n; cin >> n;
	for ( int i = 0 ; i < n ; i++ )
	nei[i].clear();

	int u, v;
    for ( int i = 0 ; i < n - 1 ; i++ ) {
    	cin >> u >> v ; u--;v--;
    	nei[u].push_back(v);nei[v].push_back(u);
	}
	int mx = 0 ;
	for ( int i = 0 ; i < n ;i++) {
		memset(vis,0,sizeof vis) ;
		mx = max(mx,DFS(i));
	}
	ans += mx ;
}
cout << ans ;
}


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

const int N = 1e6 + 10;
int vis[N] , ans = 0 ;
vector <int> nei[N];

int DFS( int x ) {
	vis[x] = 1 ;
	int mx = 0 ;
	for ( auto u : nei[x] ) {
		if ( !vis[u] )
		mx = max( mx , DFS(u) + 1 ) ;
	}
	return mx;
}

int main() {
	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	int tc; cin >> tc;
	while(tc--) {
	int n; cin >> n;
	for ( int i = 0 ; i < n ; i++ )
	nei[i].clear();

	int u, v;
    for ( int i = 0 ; i < n - 1 ; i++ ) {
    	cin >> u >> v ; u--;v--;
    	nei[u].push_back(v);nei[v].push_back(u);
	}
	int mx = 0 ;
	for ( int i = 0 ; i < n ;i++) {
		memset(vis,0,sizeof vis) ;
		mx = max(mx,DFS(i));
	}
	ans += mx ;
}
cout << ans ;
}


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

const int N = 1e6 + 10;
int vis[N] , ans = 0 ;
vector <int> nei[N];

int DFS( int x ) {
	vis[x] = 1 ;
	int mx = 0 ;
	for ( auto u : nei[x] ) {
		if ( !vis[u] )
		mx = max( mx , DFS(u) + 1 ) ;
	}
	return mx;
}

int main() {

	  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
	int tc; cin >> tc;

	while(tc--) {
	int n; cin >> n;
	for ( int i = 0 ; i < n ; i++ )
	nei[i].clear();

	int u, v;
    for ( int i = 0 ; i < n - 1 ; i++ ) {
    	cin >> u >> v ;
    	nei[u].push_back(v);nei[v].push_back(u);
	}
	int mx = 0 ;
	for ( int i = 0 ; i < n ;i++) {
		memset(vis,0,sizeof vis) ;
		mx = max(mx,DFS(i));
	}
	ans += mx ;
}
cout << ans ;
}


#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define itereq(i,k,n) for(int i = k; i<=n; i++)
#define iter(i,k,n) for(int i = k; i<n; i++)
#define iterd(i,n) for(int i = n; i>=0; i--)
#define ii pair <int, int>
#define vi vector<int>
#define print(i) cout << i << endl
#define si set<int>::iterator
#define msi multiset<int>::iterator
#define ll long long

vi graph[1000];
int t,n,x,y,res;

void dfs(int cur, int par, int path, int& m) {
    if(path > m) m = path;
    iter(i,0,graph[cur].size()) {
        if(graph[cur][i] == par) continue;
        dfs(graph[cur][i],cur,path+1,m);
    }
}

int maxDfs(int n) {
    int m = -1;
    itereq(i,1,n) {
        dfs(i,-1,0,m);
    }
    return m;
}

int main() {
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    cin >> t;
    res = 0;
    while(t--) {
        cin >> n;
        itereq(i,1,n-1) {
            cin >> x >> y;
            graph[x].push_back(y);
            graph[y].push_back(x);
        }
        res += maxDfs(n);
        print(res);
        itereq(i,1,n) graph[i].clear();
    }
    print(res);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define itereq(i,k,n) for(int i = k; i<=n; i++)
#define iter(i,k,n) for(int i = k; i<n; i++)
#define iterd(i,n) for(int i = n; i>=0; i--)
#define ii pair <int, int>
#define vi vector<int>
#define print(i) cout << i << endl
#define si set<int>::iterator
#define msi multiset<int>::iterator
#define ll long long

vi graph[1000];
int t,n,x,y,res;

void dfs(int cur, int par, int path, int& m) {
    if(path > m) m = path;
    iter(i,0,graph[cur].size()) {
        if(graph[cur][i] == par) continue;
        dfs(graph[cur][i],cur,path+1,m);
    }
}

int maxDfs(int n) {
    int m = -1;
    itereq(i,1,n) {
        dfs(i,-1,0,m);
    }
    return m;
}

int main() {
    cin >> t;
    res = 0;
    while(t--) {
        cin >> n;
        itereq(i,1,n-1) {
            cin >> x >> y;
            graph[x].push_back(y);
            graph[y].push_back(x);
        }
        res += maxDfs(n);
        print(res);
        itereq(i,1,n) graph[i].clear();
    }
    print(res);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define itereq(i,k,n) for(int i = k; i<=n; i++)
#define iter(i,k,n) for(int i = k; i<n; i++)
#define iterd(i,n) for(int i = n; i>=0; i--)
#define ii pair <int, int>
#define vi vector<int>
#define print(i) cout << i << endl
#define si set<int>::iterator
#define msi multiset<int>::iterator
#define ll long long

vi graph[1000];
int t,n,x,y,res;

void dfs(int cur, int par, int path, int& m) {
    if(path > m) m = path;
    iter(i,0,graph[cur].size()) {
        if(graph[cur][i] == par) continue;
        dfs(graph[cur][i],cur,path+1,m);
    }
}

int maxDfs(int n) {
    int m = -1;
    itereq(i,1,n) {
        dfs(i,-1,0,m);
    }
    return m;
}

int main() {
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    cin >> t;
    res = 0;
    while(t--) {
        cin >> n;
        itereq(i,1,n-1) {
            cin >> x >> y;
            graph[x].push_back(y);
            graph[y].push_back(x);
        }
        res += maxDfs(n);
        itereq(i,1,n) graph[i].clear();
    }
    print(res);
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int n;
vector<vector<int>> e;
vector<int> d;

void dfs(int x, int p) {
	for (int y : e[x]) {
		if (y != p) {
			d[y] = d[x] + 1;
			dfs(y, x);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	int t, s=0;
	cin >> t;
	while (t--) {
		cin >> n;
		e.assign(n+1, {});
		d.assign(n+1, 0);
		for (int i=1; i<n; i++) {
			int u, v;
			cin >> u >> v;
			e[u].push_back(v);
			e[v].push_back(u);
		}
		dfs(1, 1);
		int a = max_element(d.begin(), d.end()) - d.begin();
		d[a] = 0;
		dfs(a, a);
		s += *max_element(d.begin(), d.end());
	}
	cout << s << '\n';
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int n;
vector<int> e[105];
int d[105];

void dfs(int x, int p) {
	for (int y : e[x]) {
		if (y != p) {
			d[y] = d[x] + 1;
			dfs(y, x);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	int t, s=0;
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i=1; i<=n; i++)
			e[i].clear();
		fill(d+1, d+n+1, 0);
		for (int i=1; i<n; i++) {
			int u, v;
			cin >> u >> v;
			e[u].push_back(v);
			e[v].push_back(u);
		}
		dfs(1, 1);
		int a = max_element(d, d+n+1) - d;
		d[a] = 0;
		dfs(a, a);
		s += *max_element(d, d+n+1);
	}
	cout << s << '\n';
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int n;
vector<basic_string<int>> e;
basic_string<int> d;

void dfs(int x, int p) {
	for (int y : e[x]) {
		if (y != p) {
			d[y] = d[x] + 1;
			dfs(y, x);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	int t, s=0;
	cin >> t;
	while (t--) {
		cin >> n;
		e.assign(n+1, {});
		d.assign(n+1, 0);
		for (int i=1; i<n; i++) {
			int u, v;
			cin >> u >> v;
			e[u] += v;
			e[v] += u;
		}
		dfs(1, 1);
		int a = max_element(d.begin(), d.end()) - d.begin();
		d[a] = 0;
		dfs(a, a);
		s += *max_element(d.begin(), d.end());
	}
	cout << s << '\n';
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int n;
vector<int> e[105];
int d[105];

void dfs(int x, int p) {
	for (int y : e[x]) {
		if (y != p) {
			d[y] = d[x] + 1;
			dfs(y, x);
		}
	}
}

int main() {
	ifstream ifs("input.txt");
	ofstream ofs("output.txt");

	int t, s=0;
	ifs >> t;
	while (t--) {
		ifs >> n;
		for (int i=1; i<=n; i++)
			e[i].clear();
		fill(d+1, d+n+1, 0);
		for (int i=1; i<n; i++) {
			int u, v;
			ifs >> u >> v;
			e[u].push_back(v);
			e[v].push_back(u);
		}
		dfs(1, 1);
		int a = max_element(d, d+n+1) - d;
		d[a] = 0;
		dfs(a, a);
		s += *max_element(d, d+n+1);
	}
	ofs << s << '\n';
}


import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] first = in.nextLine().split(" ");
        int n = Integer.valueOf(first[0]);
        int b = Integer.valueOf(first[1]);

        String[] second = in.nextLine().split(" ");
        int[] c = new int[second.length];
        int sum = 0;
        for (int i = 0; i < c.length; i++) {
        	c[i] = Integer.valueOf(second[i]);
        	sum += c[i];
        }

        double q = (double)(b + sum) / n;
        String result = "";
        for (int i = 0; i < c.length; i++) {
        	if (c[i] > q) {
        		System.out.println(-1);
        		return;
        	}
        	result += String.format(new Locale("Russian"), "%.6f", (q - c[i])) + "\n";
        }

        System.out.println(result);
    }
}


import java.util.*;
// warm-up
public class ProblemAboutEquation {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int i=0;
		double noc=sc.nextDouble(), v=sc.nextDouble(), sum=v, n=noc;
		double m = Double.MIN_VALUE;
		double[] a = new double[(int)noc];
		while (noc-->0) {
			double o = sc.nextDouble();
			m=(o>m) ? o : m;
			a[i++]=o;
			sum+=o;
		}
		double t = sum/n;
		if (t<m) System.out.println(-1);
		else for (double b : a) System.out.println(t-b);
		sc.close();
	}

	public static void main(String args[]) {
		solve();
	}

}


#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, b;
    cin >> n >> b;

    vector <int> v;
    double sum = b;

    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        v.pb(x);
        sum += x;
    }
    double k = sum / n;

    for(int i = 0; i < n; i++){
        if(v[i] > k) return cout << -1 << endl, 0;
    }

    for(int i = 0; i < n; i++){
        cout << fixed << setprecision(6) << k - v[i] << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, b;
    cin >> n >> b;

    vector <int> v;
    int sum = b;

    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        v.pb(x);
        sum += x;
    }
    double k = sum / n;

    for(int i = 0; i < n; i++){
        if(v[i] > k) return cout << -1 << endl, 0;
    }

    for(int i = 0; i < n; i++){
        cout << fixed << setprecision(6) << k - v[i] << endl;
    }

    return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

typedef long long llong;

const int MAXN = 2002;

llong A[MAXN][MAXN];

int main(int argc, char *argv[]) {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int P;
   cin >> P;
   for(int xi = 0; xi < MAXN; ++xi) {
      int prod = 1;
      for(int pi = 0; pi < MAXN; ++pi) {
         A[xi][pi] = prod;
         prod = (prod * xi) % P;
      }
   }
   int res = 0;
   for(int xi = 0; xi < P; ++xi) {
      bool ok = true;
      for(int pi = 1; pi <= P - 2; ++pi) {
         if((P + A[xi][pi] - 1) % P == 0) {
            ok = false;
            break;
         }
      }
      if((P + A[xi][P-1] - 1) % P != 0) ok = false;
      if(ok) res++;
   }
   cout << res << endl;
   return 0;}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

typedef long long llong;

const int MAXN = 2002;

llong A[MAXN][MAXN];

int main(int argc, char *argv[]) {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int P;
   cin >> P;
   for(int xi = 0; xi < MAXN; ++xi) {
      int prod = 1;
      for(int pi = 0; pi < MAXN; ++pi) {
         A[xi][pi] = prod;
         prod = (prod * xi) % P;
      }
   }
   int res = 0;
   for(int xi = 0; xi < P; ++xi) {
      bool ok = true;
      for(int pi = 1; pi <= P - 2; ++pi) {
         if((P + A[xi][pi] - 1) % P == 0) {
            ok = false;
            break;
         }
      }
      if((P + A[xi][P-1] - 1) % P != 0) ok = false;
      if(ok) res++;
   }
   cout << res << endl;
   return


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

typedef long long llong;

const int MAXN = 2002;

llong A[MAXN][MAXN];

int main(int argc, char *argv[]) {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int P;
   cin >> P;
   for(int xi = 0; xi < MAXN; ++xi) {
      int prod = 1;
      for(int pi = 0; pi < MAXN; ++pi) {
         A[xi][pi] = prod;
         prod = (prod * xi) % P;
      }
   }
   int res = 0;
   for(int xi = 0; xi < P; ++xi) {
      bool ok = true;
      for(int pi = 1; pi <= P - 2; ++pi) {
         if((P + A[xi][pi] - 1) % P == 0) {
            ok = false;
            break;
         }
      }
      if((P + A[xi][P-1] - 1) % P != 0) ok = false;
      if(ok) res++;
   }
   cout << res << endl;
   return
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
int jami, b, i, a, mas[105];
double n, h;
int main() {
    cin >> a >> b;
    for (i = 0; i < a; i++) {
        cin >> mas[i];
    }
    for (i = a - 1; i >= 0; i--) {
        jami += * max_element(mas, mas + a) - mas[i];
    }
    if (b >= jami) {
        n = b - jami;
        n = n / a;
        n = * max_element(mas, mas + a) + n;
        for (i = 0; i < a; i++) {
            h = n - mas[i];
            printf("%.6f\n", h);
        }
    } else {
        cout << "-1";
    }
}


#define _CRT_SECURE_NO_WARNINGS
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef long double ld;
typedef vector<int> vi;
typedef long long ll;

int n;
int b;

vi a;

void input() {
  cin >> n >> b;

  a.resize(n);
  for (auto&& i : a)
    cin >> i;
}

void solve() {
  int maxo = *max_element(a.cbegin(), a.cend());

  vi ans(n);
  for (int i = 0; i < n; ++i) {
    int d = maxo - a[i];

    ans[i] += d;
    b -= d;
  }

  if (b < 0) {
    cout << "-1\n";

    return;
  }

  ld need = 1.0 * b / n;

  for (auto&& i : ans)
    cout << i + need << '\n';

  cout << '\n';
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  cin >> _times;
#endif

  while (_times--) {
    input();
    solve();
  }
}


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

int main()
{
    double maxi=0,sum=0,n,b;cin>>n>>b;
    std::vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        maxi=max(maxi,v[i]);
        sum+=v[i];}
    sum=(sum+b)/n;
    if(maxi>b){cout<<-1;}
    else{
        for(int i=0;i<n && b>0;i++)
            {v[i]=sum-v[i];
            b-=(sum-v[i]);}
        for(int i=0;i<n;i++){
            printf("%.6lf\n",v[i]);
        }
    }
}


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

int main()
{
    double n,b;cin>>n>>b;
    std::vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        b+=v[i];}
    b/=n;
    sort(v.begin(), v.end());
    if(v[v.size()-1]>b){cout<<-1;}
    else{for(int i=0;i<n;i++)
        printf("%.6lf\n",(b-v[i]));}
}


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

int main()
{
    double maxi=0,sum=0,n,b;cin>>n>>b;
    std::vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        maxi=max(maxi,v[i]);
        sum+=v[i];}
    sum=(sum+b)/n;
    if(maxi>sum){cout<<-1;}
    else{
        for(int i=0;i<n;i++){
            printf("%.6lf\n",sum-v[i]);
        }
        }
    }


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

int main()
{
    double n,b;cin>>n>>b;
    std::vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        b+=v[i];}
    b/=n;
    for(int i=0;i<n;i++)
        printf("%.6lf\n",(b-v[i]));
}


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

int main()
{
    double maxi=0,sum=0,n,b;cin>>n>>b;
    std::vector<double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        maxi=max(maxi,v[i]);
        sum+=v[i];}
    sum=(sum+b)/n;
    if(maxi>b){cout<<-1;}
    else{
        for(int i=0;i<n;i++){
            printf("%.6lf\n",sum-v[i]);
        }
        }
    }


#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define     sz(x)       (int)x.size()
#define  ld             long double
#define  vi             vector<int>
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               100006
#define in              1234567890;
int main()
{
    fast()
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ll n,i,t,j=0,x,y,k=1,c=0;
    cin>>n>>t;c+=t;
    ll a[n+1];
    vector<float> v;
    for(i=1;i<=n;i++) cin>>a[i],c+=a[i];
    y=c/n;
    if(c%n) cout<<-1;
    else{
        for(i=1;i<=n;i++){
            v.push_back(float(y)-float(a[i]));
            if(y-a[i]<0) k=0;
            //printf("%.6f\n",v);
        }
        if(k) for(i=0;i<n;i++) printf("%.6f\n",v[i]);
        else cout<<-1;
    }

}


#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define     sz(x)       (int)x.size()
#define  ld             long double
#define  vi             vector<int>
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               100006
#define in              1234567890;
int main()
{
    fast()
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ll n,i,t,j=0,x,k=1,c=0;
    cin>>n>>t;c+=t;
    ll a[n+1];
    float y;
    vector<float> v;
    for(i=1;i<=n;i++) cin>>a[i],c+=a[i];
    y=float(c)/float(n);
    //if(c%n) cout<<-1;

        for(i=1;i<=n;i++){
            v.push_back(float(y)-float(a[i]));
           if(y-a[i]<0) k=0;
           // printf("%.6f\n",v);
        }
        if(k) for(i=0;i<n;i++) printf("%.6f\n",v[i]);
        else cout<<-1;

}


#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define     sz(x)       (int)x.size()
#define  ld             long double
#define  vi             vector<int>
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               100006
#define in              1234567890;
int main()
{
    fast()
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ll n,i,t,j=0,x,k=1,c=0;
    cin>>n>>t;
    c+=t;
    ll a[n+1];
    float y;
    float v;
    for(i=1; i<=n; i++)
        cin>>a[i],j=max(a[i],j),c+=a[i];
    y=float(c)/float(n);
    if(y<float(j))
        cout<<-1;
    else
    {
        for(i=1; i<=n; i++)
        {
            v=(y-a[i]);
            printf("%.6f\n",v);
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define     sz(x)       (int)x.size()
#define  ld             long double
#define  vi             vector<int>
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               100006
#define in              1234567890;
int main()
{
    fast()
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ll n,i,t,j=0,x,k=1;
    float y,v,c=0;
    cin>>n>>t;
    c+=t;
    ll a[n+1];
    for(i=1; i<=n; i++)
        cin>>a[i],j=max(a[i],j),c+=a[i];
    y=c/n;
    if(y<float(j))
        cout<<-1;
    else
    {
        for(i=1; i<=n; i++)
        {
            v=(y-a[i]);
            printf("%.6f\n",v);
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define     sz(x)       (int)x.size()
#define  ld             long double
#define  vi             vector<int>
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               100006
#define in              1234567890;
int main()
{
    fast()
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ll n,i,t,j=0,x,k=1;
    double y,v,c=0;
    cin>>n>>t;
    c+=t;
    ll a[n+1];
    for(i=1; i<=n; i++)
        cin>>a[i],j=max(a[i],j),c+=a[i];
    y=c/n;
    if(y<double(j))
        cout<<-1;
    else for( i=1; i<=n; i++) cout<<fixed<<setprecision(6)<<(double)(y-a[i])<<endl;
}


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

using ll = long long;
#define endl '\n'

int32_t main() {

  ll n,b;
  cin >> n >> b;
  vector<ll> A(n);
  for (auto& x : A) cin >> x;
  int max_elm = *max_element(A.begin(), A.end());
  vector<double> add(n);
  for (int i = 0; i < n; ++i) {
    if (A[i] < max_elm) {
      b -= max_elm - A[i];
      add[i] = max_elm - A[i];
    }
  }
  if (b < 0) {
    cout << -1 << endl;
    return 0;
  }
  double extra = double(b) / n;
  for (int i = 0; i < n; ++i) {
    double ans = add[i] + extra;
    cout << fixed << setprecision(12) << ans << endl;
  }

}


#include <bits/stdc++.h>

using namespace std;

vector<float> solve(int n, int b){
    vector<int> mugs(n, 0);
    vector<float> ans(n,0);
    int m = 0;
    for(int i = 0 ; i < n ; i++){
        cin >> mugs[i];
        m = max(mugs[i], m);
    }
    for(int i = 0; i < n; i++){
        ans[i] += m - mugs[i];
        b -= m - mugs[i];
        if(b < 0){
            return {};
        }
    }
    for(int i = 0; i < n; i++){
        ans[i] += b / n;
    }
    return ans;

}

int main(){
    int n, b;
    scanf("%d %d", &n, &b);
    vector<float> ans = solve(n, b);
    if(!ans.size()){
        cout << -1;
        return 0;
    }
    for(int i = 0 ; i < n; i++){
        cout << fixed << setprecision(6) << ans[i] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<float> solve(int n, int b){
    vector<int> mugs(n, 0);
    vector<float> ans(n,0);
    int m = 0;
    for(int i = 0 ; i < n ; i++){
        cin >> mugs[i];
        m = max(mugs[i], m);
    }
    for(int i = 0; i < n; i++){
        ans[i] += m - mugs[i];
        b -= m - mugs[i];
        if(b < 0){
            return {};
        }
    }
    for(int i = 0; i < n; i++){
        ans[i] += (float)b / n;
    }
    return ans;

}

int main(){
    int n, b;
    scanf("%d %d", &n, &b);
    vector<float> ans = solve(n, b);
    if(!ans.size()){
        cout << -1;
        return 0;
    }
    for(int i = 0 ; i < n; i++){
        cout << fixed << setprecision(6) << ans[i] << endl;
    }
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define debug(x) cout<<":["<<x<<"DE]"<<endl;
#define debug2(x,y) cout<<"["<<x<<" "<<y<<"DE]"<<endl;

using namespace std;

//ll n,c,l1[102],f[101];
//
/////RECURSION
////ll subset(ll i,ll to_make)
////{
////    //debug2(i,to_make)
////    if(to_make==0)return 1;
////    else if(i>m||to_make<0)return 0;
////    ll a=subset(i+1,to_make);
////    ll b=subset(i+1,to_make-l1[i])+;
////    //debug2(i,to_make)cout<<"=>";debug(a+b)
////    return a+b;
////}
//
//ll subset(ll i,ll to_make)
//{
//    //debug2(i,to_make)
//    if(i>n)return 0;
//    ll a=subset(i+1,to_make);
//    ll b=-1;
//    if(l1[i]<=to_make)b=subset(i+1,to_make-l1[i])+f[i];
//    //debug2(i,to_make)cout<<"=>";debug(a+b)
//    return max(a,b);
//}

///Memoization/Top-down(DP)

int main()///PROBLEM 0-1 KNAPSACK(TOPH)
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

//    ll t,ca=0;
//    cin>>t;
//    while(t--){
//        cin>>n>>c;
//        for(int i=1;i<=n;i++){
//            cin>>l1[i]>>f[i];
//        }
//        cout<<"Case "<<++ca<<": "<<subset(1,c)<<endl;
//    }
    ll n,b,s=0;
    cin>>n>>b;
    ll a[n+1];double c[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s+=a[i];
    }
    s+=b;//debug(s%n)
    //if((s%n))cout<<-1<<endl;
    //else{
        for(int i=1;i<=n;i++){
            c[i]=(double)((s/(n+0.0))-a[i]);
            if(c[i]<0.0){cout<<-1;return 0;}
        }
        for(int i=1;i<=n;i++)cout<<fixed<<setprecision(6)<<c[i]<<endl;
    //}
}


// IN THE NAME OF ALLAH
// MOST GRACIOUS, MOST MERCIFUL
// We mere live in a simulation, a game
// and it's programmer is one and only Allah!
#include <bits/stdc++.h>
#include <iomanip>
#define N 123456789
#define INF INFINITY
#define ll long long
using namespace std;

//sieve of eratosthenes
vector<int>prime;
void SieveOfEratosthenes(int n){
	bool prme[n+1];
    memset(prme, true, sizeof(prme));
    for (int p=2; p*p<=n; p++){
        if (prme[p] == true){
            for (int i=p*p; i<=n; i += p)
                prme[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prme[p])
          prime.push_back(p);
}

void solve()
{
	int n, b;cin>>n>>b;
	double val = b*1.0, mx = 0;
	vector<double>v(n);
	for(int i = 0;i<n;i++){
		cin>>v[i];
		mx = max(mx, v[i]);
		val+=v[i];
	}
	double x = val/n;
	if(x<mx)cout<<-1;
	else{
		for(int i = 0;i<n;i++){
			cout<<setprecision(6);
			cout<<fixed<<x-v[i]<<'\n';
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	/*int t;cin>>t;
	while(t--)solve();
	*/solve();
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define MOD 1000000007
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
bool vowel(char c) {
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true;
	else return false;
}
void solve() {
	int n, b;
	cin >> n >> b;
	int a[n];
	for (int i =0 ;i < n;i++) cin >> a[i];
	int sum = 0;
	for (int i = 0;i < n;i++) {
		sum += a[i];
	}
	int tot = sum + b;
	double ave = tot * 1.0 / b;
	for (int i = 0;i < n;i++) {
		if (a[i] > ave) {
			cout << "-1\n";
			return;
		}
	}
	for (int i =0;i < n;i++) {
		cout << setprecision(6) << fixed << ave - a[i] << endl;
	}
}
int main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1;
//	cin >> t;
	while (t--) solve();
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define debug4(n, m, x, y) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << ' ' << y << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) if (n < 0) n = 0
#define MOD 1000000007
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
bool vowel(char c) {
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true;
	else return false;
}
void solve() {
	int n, b;
	cin >> n >> b;
	int a[n];
	for (int i =0 ;i < n;i++) cin >> a[i];
	int sum = 0;
	for (int i = 0;i < n;i++) {
		sum += a[i];
	}
	int tot = sum + b;
	double ave = tot * 1.0 / n;
	for (int i = 0;i < n;i++) {
		if (a[i] > ave) {
			cout << "-1\n";
			return;
		}
	}
	for (int i =0;i < n;i++) {
		cout << setprecision(6) << fixed << ave - a[i] << endl;
	}
}
int main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1;
//	cin >> t;
	while (t--) solve();
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int n, b;
    cin>>n>>b;

    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    int mx = *max_element(a.begin(), a.end());
    int s = accumulate(a.begin(), a.end(), 0);

    if((s+b)/n<mx) cout<<-1;
    else for(int i=0; i<n; i++) cout<<fixed<<setprecision(6)<<(double)((s+b)/n-a[i])<<'\n';

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int n, b;
    cin>>n>>b;

    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    int mx = *max_element(a.begin(), a.end());
    double s = accumulate(a.begin(), a.end(), 0);

    if((s+b)/n<mx) cout<<-1;
    else for(int i=0; i<n; i++) cout<<fixed<<setprecision(6)<<(double)((s+b)/n-a[i])<<'\n';

    return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cctype>
using namespace std;

int main()
{
    int n, b, a[100], c[100];
    double sum = 0;
    cin >> n >> b;
    sum += b;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        c[i] = a[i];
        sum += a[i];
    }
    sort(c, c + n);
    sum /= n;
    int max = c[b - 1];
    if (sum < max)
    {
        cout << -1 << endl;
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            cout << fixed << setprecision(6) << sum - a[i] << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cctype>
using namespace std;

int main()
{
    double n, b, a[100], sum = 0, z;
    cin >> n >> b;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    z = (sum + b) / n;
    for (int i = 0; i < n; i++)
    {
        a[i] = z - a[i];
        if (a[i] < 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    for (int i = 0; i < n ; i++)
    {
        cout << fixed << setprecision(6) << a[i] << endl;
    }
    return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cctype>
using namespace std;

int main()
{
    int n, b, a[100], c[100];
    double sum = 0;
    cin >> n >> b;
    sum += b;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        c[i] = a[i];
        sum += a[i];
    }
    sort(c, c + n);
    sum /= n;
    if (sum < c[b - 1])
    {
        cout << -1 << endl;
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            cout << fixed << setprecision(6) << sum - a[i] << endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<windows.h>
#include<string>
#include<bitset>
using namespace std;
int main()
{
    int a , b;
    cin >> a >> b;
    int c[a];
    double d=0;
    int e=0 , f=0;
    for(int i=0;i<a;i++)
    {
        cin >> c[i];
        e+=c[i];
        f=max(c[i] , f);
    }
    d=(e/1.0+b/1.0)/a/1.0;
    if(d<f)
    {
        cout << "-1" << endl;
        return 0;
    }
    else{
        for(int i=0;i<a;i++)
        {
            printf("%.6f" , d-c[i]);
            cout << endl;
        }
    }
}


#include<bits/stdc++.h>
#include<windows.h>
#include<string>
#include<bitset>
using namespace std;
int main()
{
    int a , b;
    cin >> a >> b;
    int c[a];
    double d=0;
    int e=0 , f=0;
    for(int i=0;i<a;i++)
    {
        cin >> c[i];
        e+=c[i];
        f=max(c[i] , f);
    }
    d=(e/1.0+b/1.0)/a/1.0;
    if(d<f])
    {
        cout << "-1" << endl;
        return 0;
    }
    else{
        for(int i=0;i<a;i++)
        {
            printf("%.6f" , d-c[i]);
            cout << endl;
        }
    }
}


#include<bits/stdc++.h>
#include<windows.h>
#include<string>
#include<bitset>
using namespace std;
int main()
{
    int a , b;
    cin >> a >> b;
    int c[a];
    double d=0;
    int e=0;
    for(int i=0;i<a;i++)
    {
        cin >> c[i];
        e+=c[i];
    }
    d=(e/1.0+b/1.0)/a/1.0;
    sort(c , c+a);
    if(d<c[a-1])
    {
        cout << "-1" << endl;
        return 0;
    }
    else{
        for(int i=0;i<a;i++)
        {
            printf("%.6f" , d-c[i]);
            cout << endl;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    double n, b;
    cin >> n >> b;
    double sum = 0;
    vector<double>test(n);
    for(double i = 0; i < n; ++i){
        cin >> test[i];
        if(i != 0){
            sum += test[i];
        }
    }
    vector<double>answer;
    double c1 = (b - (n-1)*test[0]+sum) / n;
    answer.push_back(c1);
  //  cout << c1 << endl;
    for(int i = 1; i < n; ++i){
        answer.push_back(test[0] + c1 - test[i]);
    }
    for(double s : answer){
        if(s <= 0){
            cout << -1 << endl;
            return;
        }
    }
    for(double s : answer){
        cout << s << endl;
    }
}

int main()
{
    cout << fixed << setprecision(20);
    solve();
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    double n, b;
    cin >> n >> b;
    double sum = 0;
    vector<double>test(n);
    for(double i = 0; i < n; ++i){
        cin >> test[i];
        if(i != 0){
            sum += test[i];
        }
    }
    vector<double>answer;
    double c1 = (b - (n-1)*test[0]+sum) / n;
    answer.push_back(c1);
  //  cout << c1 << endl;
    for(int i = 1; i < n; ++i){
        answer.push_back(test[0] + c1 - test[i]);
    }
    for(double s : answer){
        if(s < 0){
            cout << -1 << endl;
            return;
        }
    }
    for(double s : answer){
        cout << s << endl;
    }
}

int main()
{
    cout << fixed << setprecision(20);
    solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int32_t main()
{
	int n,b;
	cin>>n>>b;
	double arr[n];
	double copy[n];
	for(int i=0;i<n;i++)
	{cin>>arr[i];
	copy[i]=arr[i];
	}

	sort(arr,arr+n);
	double m=arr[n-1];
	double s=0;
	for(int i=0;i<n;i++)
	s+=m-arr[i];
	if(s>b)
	cout<<-1;
	else
	{	//cout<<s;
		double x=(b-s)/n;
		//cout<<x<<" "<<"\n";
			for(int i=0;i<n;i++)
			{
			double ans=m-copy[i]+x;
				cout<<fixed<<setprecision(6)<<ans<<"\n";
			}

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int32_t main()
{
	int n,b;
	cin>>n>>b;
	double arr[n];
	double copy[n];
	for(int i=0;i<n;i++)
	{cin>>arr[i];
	copy[i]=arr[i];
	}

	sort(arr,arr+n);
	double m=arr[n-1];
	double s=0;
	for(int i=0;i<n;i++)
	s+=m-arr[i];
	if(s>b)
	cout<<-1;
	else
	{	//cout<<s;
		double x=(b-s)/n;
		//cout<<x<<" "<<"\n";
			for(int i=0;i<n;i++)
			{

			double ans=m-copy[i]+x;

			cout<<fixed<<setprecision(6)<<ans<<"\n";
			}

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int32_t main()
{
	int n,b;
	cin>>n>>b;
	int arr[n];
	int copy[n];
	for(int i=0;i<n;i++)
	{cin>>arr[i];
	copy[i]=arr[i];
	}

	sort(arr,arr+n);
	int m=arr[n-1];
	int s=0;
	for(int i=0;i<n;i++)
	s+=m-arr[i];
	if(s>b || (s<b && (b-s)%n!=0))
	cout<<-1;
	else
	{
		int x=(b-s)/n;
			for(int i=0;i<n;i++)
			{
			double ans=m-copy[i]+x;
				cout<<fixed<<setprecision(6)<<ans<<"\n";
			}

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int32_t main()
{
	int n,b;
	cin>>n>>b;
	int arr[n];
	for(int i=0;i<n;i++)
	cin>>arr[i];

	sort(arr,arr+n);
	int m=arr[n-1];
	int s=0;
	for(int i=0;i<n;i++)
	s+=m-arr[i];
	if(s>b || (s<b && (b-s)%n!=0))
	cout<<-1;
	else
	{
		int x=(b-s)/n;
			for(int i=0;i<n;i++)
			{
			double ans=m-arr[i]+x;
				cout<<fixed<<setprecision(6)<<ans<<"\n";
			}

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define w(t) int t; cin>>t; while(t--)
#define mod 1e9+7;
#define pb push_back

int32_t main()
{
	int n,b;
	cin>>n>>b;
	int arr[n];
	int copy[n];
	for(int i=0;i<n;i++)
	{cin>>arr[i];
	copy[i]=arr[i];
	}

	sort(arr,arr+n);
	int m=arr[n-1];
	int s=0;
	for(int i=0;i<n;i++)
	s+=m-arr[i];
	if(s>b)
	cout<<-1;
	else
	{
		double x=(b-s)/n;
			for(int i=0;i<n;i++)
			{
			double ans=m-copy[i]+x;
				cout<<fixed<<setprecision(6)<<ans<<"\n";
			}

	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m,sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int total = m + sum;
    double avg = (double)total/n;
    for (int i = 0; i < n; ++i) {
        if ( a[i] > avg ) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << fixed << setprecision(6);
    for (auto item: a) cout << avg - item << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m,sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int total = m + sum;
    double avg = total/n;
    for (int i = 0; i < n; ++i) {
        if ( a[i] > avg ) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << fixed << setprecision(6);
    for (auto item: a) cout << avg - item << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m,sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int total = m + sum;
    double avg = total/n;
    for (int i = 0; i < n; ++i) {
        if ( a[i] > avg ) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << fixed << setprecision(8);
    for (auto item: a) cout << avg - item << endl;
    return 0;
}


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

int main() {
    int n, b;
    cin >> n >> b;
    int m = 0;
    vector<int> a;
    for (int i=0; i<n; i++) {
        int t;
        cin >> t;
        m = max(m, t);
        a.push_back(t);
    }
    for (int i=0; i<n; i++) {
        b -= m-a[i];
        a[i] = m-a[i];
    }
    if (b < 0) cout << -1;
    else {
        cout.precision(6);
        for (int i=0; i<n; i++) {
            cout << fixed <<  a[i]+(double)b/n << endl;;
        }
    }
}


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

int main()
{
    int n;
	double b;
	cin>>n>>b;
	vector<double>a(n);
	double mx = 0;
	double s = 0;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
		s+=a[i];
		mx = max(mx, a[i]);
	}
	double c = (double)(b+s)/n;

	if(c<mx)
	{
		cout<<-1<<endl;
	}
	for(int i = 0; i < n; i++)
	{
		cout<<fixed << setprecision(6)<<c-a[i]<<endl;
	}

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define for1(i, n) for(int i = 1; i <= int(n); ++i)
#define ford(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define sz(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define X first
#define Y second
#define mp make_pair
#define debug(x) {cerr << #x << " = " << x << endl;}
template<typename T> inline T abs(T a){ return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a){ return a * a; }

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = (int)1E9 + 7;
const ld EPS = 1E-9;
const ld PI = 3.1415926535897932384626433832795;

int main() {
    #ifdef myproject
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
    #endif

    string s;
    cin >> s;

    vector<char> q;
    vector<pt> out;

    forn(i, sz(s)){
//        cerr << i << endl;
        if(s[i] == '<' && i+1 < sz(s) && s[i+1] == '/'){
            q.pop_back();
            out.pb(mp(sz(q), -int(s[i+2])));
            ++i;
        }

        if(s[i] == '<'){
            out.pb(mp(sz(q), s[i+1]));
            q.pb(s[i+1]);
            ++i;
        }
    }

    forn(i, sz(out)){
//        cerr << out[i].Y << endl;
        forn(j, 2*out[i].X)
            printf(" ");
        if(out[i].Y < 0)
            printf("</%c>\n", char(-out[i].Y));
        else
            printf("<%c>\n", char(out[i].Y));
    }

    return 0;
}


// я повторяю:
// нет закона который я не нарушал.
// когда стихи всего лишь повод с тобою переспать;
// читать стихи и трахаться - одно и тоже -
// кровать, как чистый лист,
// чернила - сперма.
// какие двери открывает простое допущение;
// весь мир сошёл с ума.
// сама
// хотела.

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

string s;
int st;

int main()
{
    //freopen ("input.txt", "rt", stdin);
    //freopen ("output.txt", "wt", stdout);

    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '<')
            if (s[i+1] != '/') {
                for (int j = 0; j < st; j++)
                    cout << "  ";
                cout << "<" << s[i+1] << ">" << endl;
                st++;
            }
            else {
                st--;
                for (int j = 0; j < st; j++)
                    cout << "  ";
                cout << "</" << s[i+2] << ">" << endl;
            }
    }

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

#include <utility>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <set>

using namespace std;

typedef long long int64;
#define INF 10000000
#define prime 1103
#define FOR(a, b) for(int a = 0; a < b; ++a)
#define eps 1e-7

int h = 0, i = 0;
string s;
int main()
{
    //freopen("input.txt", "r", stdin);   freopen("output.txt", "w", stdout);
	cin >> s;
	while (i < s.length())
	{
		if (s[i + 1] == '/')
		{
			--h;
			FOR(j, 2*h)
				cout << ' ';
			cout << s[i] << s[i + 1] << s[i + 2]  << s[i + 3] << endl;
			i += 4;
		}
		else
		{
			FOR(j, 2*h)
				cout << ' ';
			cout << s[i] << s[i + 1] << s[i + 2] << endl;
			i += 3;
			++h;
		}
	}
	return 0;
}


#include <iostream>

void main() {
	char szInput[1000];
	szInput[0] = 0;

	std::cin >> szInput;

	char* current = szInput;
	short depth = 0;

	while (*current) {
		current++;

		if (*current != '/') {
			for (int i = 0; i < depth; i++) {
				std::cout << "  ";
			}

			std::cout << '<' << *current << '>' << std::endl;
			depth++;
		} else {
			current++;
			depth--;

			for (int i = 0; i < depth; i++) {
				std::cout << "  ";
			}

			std::cout << "</" << *current << '>' << std::endl;
		}

		current += 2;
	}
}


#include <iostream>

using namespace std;

int main()
{
    char data[1000];
    scanf("%s",data);
    int n = strlen(data);
    char prev;
    int h=0;
    int pos=0;
    for (int i=0; i<n;i++)
    {
        char cur = data[i];
        if (cur == '<')
        {
            if (data[i+1] == '/')
            {
                h--;
                for (int j=0; j<2*h;j++)
                    cout << " ";
                cout << cur;
            }
            else
            {
                for (int j=0; j<2*h;j++)
                    cout << " ";
                cout << cur;
                h++;
            }
        }
        else if (cur == '>')
        {
            cout << cur;
            cout << endl;
        }
        else
            cout << cur;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++i;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i + 1, j - i);
        i = j + 1;
        if (state == 1)
        {
            ++next;
        }
        else
        {
            --next;
            --curr;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << "  ";
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "</";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++i;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i + 1, j - i);
        i = j + 1;
        if (state == 1)
        {
            ++next;
        }
        else
        {
            --next;
            --curr;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << "  ";
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "<\\";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i, j - i + 1);
        i = j + 1;
        if (state == 1)
        {
            ++next;
        }
        else
        {
            --next;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << ' ';
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "<\\";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++i;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i + 1, j - i + 1);
        i = j + 1;
        if (state == 1)
        {
            ++next;
        }
        else
        {
            --next;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << ' ';
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "<\\";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++i;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i + 1, j - i);
        i = j + 1;
        if (state == 1)
        {
            ++next;
        }
        else
        {
            --next;
            --curr;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << ' ';
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "<\\";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<int> t(s.length(), 0);
    stack<string> st;
    int state = 0;
    int next = 0;
    int curr = 0;
    for (int i = 0; i < s.length(); ++i)
    {
        curr = next;
        char c = s[i];
        int j = i;
        if (c == '<')
        {
            if (s[i+1] == '/')
            {
                state = 2;
                ++j;
            }
            else
            {
                state = 1;
            }
        }
        while (j < s.length() && s[j] != '>') ++j;
        --j;
        string id = s.substr(i, j - i + 1);
        i = j + 1;
        if (state == 1)
        {
            st.push(id);
            ++next;
        }
        else
        {
            st.pop();
            --next;
        }
        for (int i = 0; i < curr; ++i)
        {
            cout << ' ';
        }
        if (state == 1)
        {
            cout << "<";
        } else
            cout << "<\\";
        cout << id << ">" << endl;
    }
    return 0;
}


#include <iostream>
#include <map>
#include <algorithm>
#include <string>

#define inf 1000000000

using namespace std;

struct stack
{
    string s;
    int kol;
};

string s;
stack st[1000];
int stn;
int main()
{
      cin>>s;
      int i=0;
      st[0].kol=-1;
    while (1)
    {
       if (i>=s.length()) break;
         string tm="";
        while (i<s.length() && s[i]!='>')
        {
           tm+=s[i];
           i++;
        }
         tm+=s[i];
         i++;
        if (tm.length()==3)
        {
            stn++;
            st[stn].s=tm;
            st[stn].kol=st[stn-1].kol+1;
            for (int j=1; j<=2*st[stn].kol; j++) cout<<" ";
            cout<<tm<<endl;
        }
        else
        {
            for (int j=1; j<=2*st[stn].kol; j++) cout<<" ";
            cout<<tm<<endl;
            stn--;
        }
    }
}


#include <iostream>
#include <fstream>
#include <conio.h>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;

char * substr(char ch[],int f,int l)
{
	char * ret = new char[10000];
	for(int i = f; i <= l;i++)
		ret[i-f] = ch[i];
	ret[l-f+1] = '\0';
	return ret;
}

int main()
{
	//ifstream cin("a.in");
	//ofstream cout("a.out");
	char ch[10000];
	cin.getline(ch,10000);
	int h = 0;
	for(int i = 0;i < strlen(ch)-1;i++)
	{
		if(ch[i] == '<' && ch[i+1] != '/')
		{
			for(int j = i;j < strlen(ch);j++)
				if(ch[j] == '>'){
					cout<<std::string(h,' ')<<substr(ch,i,j)<<endl;h+=2;break;}
		}
		else if(ch[i] == '<' && ch[i+1] == '/')
		{
			for(int j = i;j < strlen(ch);j++)
				if(ch[j] == '>'){
					h-=2;cout<<std::string(h,' ')<<substr(ch,i,j)<<endl;break;}
		}
	}
}


#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
//cout.precision(0);
//cout.setf(ios_base::fixed)

using namespace std;

int main()
{
       //  freopen("a.in","r",stdin);
	string s,h[335];
	int r;
	while(cin>>s)
	{
		r=0;
		memset(h,'\0',sizeof h);
		for(int i=0;i<s.length();i++)
			 if(s[i]!='>')
				 h[r]+=s[i];
			 else
			 {
				 h[r]+=s[i];
				 r++;
			 }
			 string q;
			 int j=0;
           for(int i=0;i<r;i++)
		   {
			   q=h[i];
			   if(q[1]!='/')
			   {
				   for(int i=0;i<2*j;i++)
					   cout<<" ";
				   cout<<q<<endl;
				   j++;
			   }
			   else
			   {
				   j--;
				   for(int i=0;i<2*j;i++)
					   cout<<" ";
				   cout<<q<<endl;

			   }
		   }
	}

	return 0;
}


#include <iostream>
#include <stack>
#include <vector>
#include <string>

using namespace std;

int main()
{
	stack<char, vector<char> > st;
	string str;
	cin >> str;
	for(int i = 0; i < str.size(); i++)
	{
		if(str[i] >= 'a' && str[i] <= 'z')
		{
			if(st.empty() || st.top() != str[i])
			{
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				st.push(str[i]);
				cout << "<" << str[i] << ">" << endl;
			}
			else
			{
				st.pop();
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				cout << "</" << str[i] << ">" << endl;
			}
		}
	}
	return 0;
}


#include <iostream>
#include <stack>
#include <vector>
#include <string>

using namespace std;

int main()
{
	stack<char, vector<char> > st;
	string str;
	cin >> str;
	for(int i = 0; i < str.size(); i++)
	{
		if(str[i] >= 'a' && str[i] <= 'z')
		{
			if(st.empty() || st.top() != str[i] || (st.top() == str[i] && str[i - 1] == '/'))
			{
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				st.push(str[i]);
				cout << "<" << str[i] << ">" << endl;
			}
			else
			{
				st.pop();
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				cout << "</" << str[i] << ">" << endl;
			}
		}
	}
	return 0;
}


#include <iostream>
#include <stack>
#include <vector>
#include <string>

using namespace std;

int main()
{
	stack<char, vector<char> > st;
	string str;
	cin >> str;
	for(int i = 0; i < str.size(); i++)
	{
		if(str[i] >= 'a' && str[i] <= 'z')
		{
			if(st.empty() || st.top() != str[i] || (st.top() == str[i] && str[i - 1] != '/'))
			{
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				st.push(str[i]);
				cout << "<" << str[i] << ">" << endl;
			}
			else
			{
				st.pop();
				for(int j = 0; j < 2 * st.size(); j++)
					cout << " ";
				cout << "</" << str[i] << ">" << endl;
			}
		}
	}
	return 0;
}


#pragma comment(linker, "/stack:64000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <cassert>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define pb push_back

typedef long long LL;

int main() {
#ifndef ONLINE_JUDGE
	#define NAME "test"
	freopen(NAME".in", "r", stdin);
	freopen(NAME".out", "w", stdout);
#endif
	string s;
	cin >> s;
	int k = -1;
	vector <string> tags;
	REP(i, sz(s)) {
		if (s[i] == '<') {
			k = i;
		} else if (s[i] == '>') {
			tags.push_back(s.substr(k + 1, i - k - 1));
		}
	}
	vector <string> stack;
	REP(i, sz(tags)) {
		string t = tags[i];
		if (t[0] == '/') {
			assert(t.substr(1) == stack.back());
			stack.pop_back();
		} else {
			stack.push_back(t);
		}
		int k = 2 * sz(stack);
		if (t[0] != '/') k -= 2;
		REP(i, k) cout << " ";
		cout << "<" << t << ">\n";
	}
	return 0;
}


#define _CRT_SECURE_NO_DEPRECATE

#pragma comment(linker,"/STACK:67108864")

#include <iostream>
#include <ctime>
#include <cstdio>
#include <memory>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <utility>
#include <iterator>
#include <bitset>
#include <sstream>
#include <numeric>

#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pdd pair<double,double>
#define LL long long
#define ULL unsigned LL
#define VI vector<int>
#define X first
#define Y second
#define sz(_v) ((int)_v.size())
#define all(_v) (_v).begin(),(_v).end()
#define FOR(i,a,b) for (int i(a); i<=(b); ++i)
#define rep(i,a) FOR(i,1,a)
#define rept(i,a) FOR(i,0,(int)(a)-1)
#define x1 X1
#define y1 Y1
#define sqr(a) ((a)*(a))
#define INF 2000000000
#define PI 3.141592653589
#define eps 0.00000000001
#define MOD 1000000009

using namespace std;

string comm;
vector< bool > isEnd;

void parse(string &s)
{
    while (s.length()>0)
    {
        int todel=3;
        if (s[1]=='/') comm+=s[2],++todel,isEnd.pb(true);
        else comm+=s[1],isEnd.pb(false);
        s.erase(s.begin(),s.begin()+todel);
    }
}

int main()
{
#ifndef ONLINE_JUDGE
    {
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    }
#endif
    string s;
    getline(cin,s);
    parse(s);
    int k(-1);
    rept(i,sz(comm))
    {
        rept(j,k)
            printf("  ");
        if (isEnd[i])
        {
            printf("</%c>\n",comm[i]);
            --k;
        }
        else
        {
            if (i!=0) printf("  <%c>\n",comm[i]);
            else printf("<%c>\n",comm[i]);
            ++k;
        }
    }
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE

#pragma comment(linker,"/STACK:67108864")

#include <iostream>
#include <ctime>
#include <cstdio>
#include <memory>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <utility>
#include <iterator>
#include <bitset>
#include <sstream>
#include <numeric>

#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pdd pair<double,double>
#define LL long long
#define ULL unsigned LL
#define VI vector<int>
#define X first
#define Y second
#define sz(_v) ((int)_v.size())
#define all(_v) (_v).begin(),(_v).end()
#define FOR(i,a,b) for (int i(a); i<=(b); ++i)
#define rep(i,a) FOR(i,1,a)
#define rept(i,a) FOR(i,0,(int)(a)-1)
#define x1 X1
#define y1 Y1
#define sqr(a) ((a)*(a))
#define INF 2000000000
#define PI 3.141592653589
#define eps 0.00000000001
#define MOD 1000000009

using namespace std;

string comm;
vector< bool > isEnd;

void parse(string &s)
{
    while (s.length()>0)
    {
        int todel=3;
        if (s[1]=='/') comm+=s[2],++todel,isEnd.pb(true);
        else comm+=s[1],isEnd.pb(false);
        s.erase(s.begin(),s.begin()+todel);
    }
}

int main()
{
#ifndef ONLINE_JUDGE
    {
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    }
#endif
    string s;
    getline(cin,s);
    parse(s);
    int k(-1);
    rept(i,sz(comm))
    {
        rept(j,k)
            printf("  ");
        if (isEnd[i])
        {
            printf("</%c>\n",comm[i]);
            --k;
        }
        else
        {
            if (k!=-1) printf("  <%c>\n",comm[i]);
            else printf("<%c>\n",comm[i]);
            ++k;
        }
    }
    return 0;
}


// Friendship is Magic
#pragma comment(linker, "/STACK:32000000")

#include <memory.h>
#include <string.h>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;

typedef long long LL;

char s[1005];
int n;

void do_solve() {
    scanf("%s", s);
    n = strlen(s);
    int pos = 0, lev = 0;
    while (pos < n)
    {
        bool open = s[pos+1] != '/';
        int npos = open ? pos + 3 : pos + 4;
        if (!open) lev--;
        for (int i = 0; i < lev; i++) printf("  ");
        for (int i = pos; i < npos; i++) printf("%c", s[i]);
        printf("\n");
        if (open) lev++;
        pos = npos;
    }
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    do_solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

void main(){
	//freopen("input.txt","r",stdin);
	vector<string> strvec;
	char tmp;
	while( cin.get(tmp) && tmp!=' '){
		string tmpstr;
		tmpstr+=tmp;
		if(tmp=='<')
			while(tmp!='>'){
				cin>>tmp;
				tmpstr+=tmp;
			}
			strvec.push_back(tmpstr);
	}
	int *a;
	a = new int [strvec.size()];
	int index=0;
	while(index<strvec.size()){
		for( int j=0; j<strvec.size(); j++){
			if( strvec[index][1] == strvec[j][2]){
				a[index] = index;
				a[j] = index;
			}
		}
		index++;
	}
	index=0;
	while(index<strvec.size()){

		for( int i=0; i<2*a[index]; i++)
			cout<<" ";
		for( int i=0; i<strvec[index].size(); i++)
			cout<<strvec[index][i];
		cout<<endl;
		index++;
	}
}


#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

void main(){
	//freopen("input.txt","r",stdin);
	vector<string> strvec;
	string tmp;
	cin>>tmp;
	int index=0;
	while( index<tmp.size()){
		string tmpstr;
		tmpstr+=tmp[index];

		if(tmp[index]=='<'){
			index++;
			while(tmp[index]!='>'){
				tmpstr+=tmp[index];
				index++;
			}
			tmpstr+=tmp[index];
		}
	index++;
			strvec.push_back(tmpstr);

	}
	//int *a;
	//a = new int [strvec.size()];
	index=0;
	/*while(index<strvec.size()){
		for( int j=0; j<strvec.size(); j++){
			if( strvec[index][1] == strvec[j][2]){
				a[index] = index;
				a[j] = index;
			}
		}
		index++;
	}*/
	index=0;
	int h=-1;
	while(index<strvec.size()){
		if( strvec[index][1] !='/')
			h++;
		for( int i=0; i<2*h; i++)
			cout<<" ";
		for( int i=0; i<strvec[index].size(); i++)
			cout<<strvec[index][i];
		cout<<endl;
		if( strvec[index][1] =='/')
			h--;

		index++;

	}
}


#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

void main(){
	//freopen("input.txt","r",stdin);
	vector<string> strvec;
	char tmp;
	while( cin.get(tmp)){
		string tmpstr;
		tmpstr+=tmp;
		if(tmp=='<')
			while(tmp!='>'){
				cin>>tmp;
				tmpstr+=tmp;
			}
			strvec.push_back(tmpstr);
	}
	int *a;
	a = new int [strvec.size()];
	int index=0;
	while(index<strvec.size()){
		for( int j=0; j<strvec.size(); j++){
			if( strvec[index][1] == strvec[j][2]){
				a[index] = index;
				a[j] = index;
			}
		}
		index++;
	}
	index=0;
	while(index<strvec.size()){

		for( int i=0; i<2*a[index]; i++)
			cout<<" ";
		for( int i=0; i<strvec[index].size(); i++)
			cout<<strvec[index][i];
		cout<<endl;
		index++;
	}
}


#include <stdio.h>
#include <string.h>

int N;
char buf[1004];

int dfs(int s,int dep)
{
    int i;
    for (i=0;i<dep+dep;i++) printf(" ");
    printf("<%c>\n",buf[s+1]);
    for (s=s+3;s<N&&buf[s+1]!='/';s=dfs(s,dep+1));
    for (i=0;i<dep+dep;i++) printf(" ");
    printf("</%c>\n",buf[s+2]);
    return s+4;
}

int main()
{
    scanf("%s",buf); N = strlen(buf);
    for (int s=0;s<N;s=dfs(s,0));
}


#include <stdio.h>
#include <string.h>

int N;
char buf[1004];

int dfs(int s,int dep)
{
    int i;
    for (i=0;i<dep+dep;i++) printf(" ");
    printf("<%c>\n",buf[s+1]);
    for (s=s+3;s<N&&buf[s+1]!='/';s=dfs(s,dep+1));
    for (i=0;i<dep+dep;i++) printf(" ");
    printf("</%c>\n",buf[s+2]);
    return s+4;
}

int main()
{
    scanf("%s",buf); N = strlen(buf);
    dfs(0,0);
}


#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<cstring>
using namespace std;
const int maxn = 1005;
char str[maxn],s[maxn];

int cnt;
void out(){
    for(int i=1;i<=cnt;++i)
        printf(" ");
}
int main(){
    while(cin>>str){
        int len = strlen(str);
        cnt = 0;
        int i = 0;
        while(i != len){
            int j = 0;
            s[j] = str[i];
            ++i; ++j;
            while(i != len && str[i] != '<')s[j++]=str[i++];
            s[j] = '\0';
            if(s[1] != '/'){
                out();
                printf("%s\n",s);
                cnt += 2;
            }else{
                cnt -= 2;
                out();
                printf("%s\n",s);
            }
        }
    }
}


#include <iostream>
#include <cmath>
#include <string>

using namespace std;

//
string s;
//

//
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//
	cin >> s;
	int h = 0;
	//
	for (int i = 0; i < s.size(); i++) {
		if ((s[i] == '<') && (s[i+1] != '/')) {
			for (int j = 0; j < 2*h; j++) cout << " ";
			while (s[i] != '>') {
				cout << s[i];
				i++;
			}
			cout << ">";
			h++;
		} else {
		if ((s[i] == '<') && (s[i+1] == '/')) {
			h--;
			for (int j = 0; j < 2*h; j++) cout << " ";
			while (s[i] != '>') {
				cout << s[i];
				i++;
			}
			cout << ">";
		}
		}
		cout << endl;
	}
	//
	return 0;
}


#include <stdio.h>
#include <string.h>

struct Node
{
   char ch;
   int set,f;
};

Node r[1005],stack[10000];
char str1[1005];

void Print(int x)
{
   int i;
   for(i = 1;i<=x;i++)
      putchar(' ');
}

int main()
{
   int i,len,count;
   int top;

   while(gets(str1))
   {
     count = 0;
     len = strlen(str1);
     for(i = 0;i<len;i++)
      if(str1[i]>='a'&&str1[i]<='z')
       r[count++].ch = str1[i];
      top = 0;
     for(i = 0;i<count;i++)
     {
         if(top==0)
         {
           r[i].f = 0;
           r[i].set = 0;
           stack[0] = r[i];
           top = 1;
           continue;
         }
         if(r[i].ch==stack[top-1].ch)
         {
            r[i].f = stack[top-1].f;
            r[i].set = 1;
            top--;
         }
        else
        {
           r[i].f = stack[top-1].f+1;
           r[i].set = 0;
           stack[top] = r[i];
           top++;
        }
     }
    for(i = 0;i<count;i++)
    {
       Print(2*r[i].f);
       putchar('<');
       if(r[i].set==1)
         putchar('/');
       putchar(r[i].ch);
       putchar('>');
       putchar('\n');
    }
   }
  return 0;
}


#include <stdio.h>
#include <string.h>

struct Node
{
   char ch;
   int set,f;
};

Node r[1005],stack[10000];
char str1[1005];

void Print(int x)
{
   int i;
   for(i = 1;i<=x;i++)
      putchar(' ');
}

int main()
{
   int i,len,count;
   int top;

   while(gets(str1))
   {
     count = 0;
     len = strlen(str1);
     for(i = 0;i<len;i++)
      if(str1[i]>='a'&&str1[i]<='z')
       r[count++].ch = str1[i];
     top = 1;
     r[0].f = 0;
     r[0].set = 0;
     stack[0] = r[0];
     for(i = 1;i<count;i++)
     {
         if(r[i].ch==stack[top-1].ch)
         {
            r[i].f = stack[top-1].f;
            r[i].set = 1;
            top--;
         }
        else
        {
           r[i].f = stack[top-1].f+1;
           r[i].set = 0;
           stack[top] = r[i];
           top++;
        }
     }
    for(i = 0;i<count;i++)
    {
       Print(2*r[i].f);
       putchar('<');
       if(r[i].set==1)
         putchar('/');
       putchar(r[i].ch);
       putchar('>');
       putchar('\n');
    }
   }
  return 0;
}


#include <stdio.h>
#include <string.h>

struct Node
{
   char ch;
   int set,f;
};

Node r[1005],stack[10000];
char str1[1005];

void Print(int x)
{
   int i;
   for(i = 1;i<=x;i++)
      putchar(' ');
}

int main()
{
   int i,len,count;
   int top;

   while(gets(str1))
   {
     count = 0;
     len = strlen(str1);
     for(i = 0;i<len;i++)
      if(str1[i]>='a'&&str1[i]<='z')
       r[count++].ch = str1[i];
     top = 1;
     r[0].f = 0;
     r[0].set = 0;
     stack[0] = r[0];
     for(i = 1;i<count;i++)
     {
         if(r[i].ch==stack[top-1].ch)
         {
            r[i].f = stack[top-1].f;
            r[i].set = 1;
            top--;
         }
        else
        {
           r[i].f = stack[top-1].f+1;
           r[i].set = 0;
           stack[top] = r[i];
           top++;
        }
     }
    for(i = 0;i<count;i++)
    {
       Print(r[i].f);
       putchar('<');
       if(r[i].set==1)
         putchar('/');
       putchar(r[i].ch);
       putchar('>');
       putchar('\n');
    }
   }
  return 0;
}


#include <stdio.h>
#include <string.h>

struct Node
{
   char ch;
   int set,f;
};

Node r[1005],stack[10000];
char str1[1005];

void Print(int x)
{
   int i;
   for(i = 1;i<=x;i++)
      putchar(' ');
}

int main()
{
   int i,len,count;
   int top;

   while(gets(str1))
   {
     count = 0;
     len = strlen(str1);
     for(i = 0;i<len;i++)
      if(str1[i]>='a'&&str1[i]<='z')
      {
       r[count].ch = str1[i];
       if(str1[i-1]=='/')
        r[count].set = 1;
       else r[count].set = 0;
       count++;
      }
      top = 0;
     for(i = 0;i<count;i++)
     {
         if(top==0)
         {
           r[i].f = 0;
           stack[0] = r[i];
           top = 1;
           continue;
         }
         if(r[i].ch==stack[top-1].ch&&r[i].set==1&&stack[top-1].set==0)
         {
            r[i].f = stack[top-1].f;
            top--;
         }
        else
        {
           r[i].f = stack[top-1].f+1;
           stack[top] = r[i];
           top++;
        }
     }
    for(i = 0;i<count;i++)
    {
       Print(2*r[i].f);
       putchar('<');
       if(r[i].set==1)
         putchar('/');
       putchar(r[i].ch);
       putchar('>');
       putchar('\n');
    }
   }
  return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;

int seen[ 100 ];
char data[ 10000000 ];

int main() {
    int cur = 0;
    cin >> data;
    int n = strlen( data );
    for( int i = 0; i < n; i ++ ) {
        if( isalpha( data[ i ] ) ) {
            if( seen[ data[ i ] - 'a' ] && data[ i - 1 ] == '/' ) {
                cur --;
            }
            for( int j = 0; j < cur * 2; j ++ ) {
                cout << ' ';
            }
            cout << '<';
            if( seen[ data[ i ] - 'a' ] && data[ i - 1 ] == '/' ) {
                cout << '/';
                seen[ data[ i ] -'a' ] --;
            }
            else if( data[ i - 1 ] != '/' ) {
                seen[ data[ i ] - 'a' ] ++;
                cur ++;
            }
            cout << data[ i ] << ">\n";
        }
    }
    return 0;
}


#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;

bool seen[ 100 ];
char data[ 10000000 ];

int main() {
    int cur = 0;
    cin >> data;
    int n = strlen( data );
    for( int i = 0; i < n; i ++ ) {
        if( isalpha( data[ i ] ) ) {
            if( seen[ data[ i ] - 'a' ] ) {
                cur --;
            }
            for( int j = 0; j < cur * 2; j ++ ) {
                cout << ' ';
            }
            cout << '<';
            if( seen[ data[ i ] - 'a' ] ) {
                cout << '/';
                seen[ data[ i ] -'a' ] = 0;
            }
            else {
                seen[ data[ i ] - 'a' ] = 1;
                cur ++;
            }
            cout << data[ i ] << ">\n";
        }
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef vector< int > VI;
typedef vector< string > VS;
typedef pair< int, int > II;
typedef long long LL;
#define FOR(i,b,e) for(int (i)=(int)(b);(i)<(int)(e);++(i))
#define FORIT(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define INF 987654321

string f(int n)
{
    return string(n, ' ');
}

int check(int i, const string &s)
{
    int n = (int)s.size();
    if (i+2 < n && s[i] == '<' && s[i+2] == '>') return -1;
    if (i+3 < n && s[i] == '<' && s[i+1] == '/' && s[i+3] == '>') return 1;
    return 0;
}

int main()
{
    string s;
    cin >> s;
    ostringstream oss;
    int space = 0;
    int i = 0;
    while (i < s.size()) {
        int flag = check(i, s);
        if (flag == -1) {
            oss << f(space) << s.substr(i, 3);
            i += 3;
            oss << endl;
            space += 2;
        }
        else if (flag == 1) {
            space -= 2;
            oss << f(space) << s.substr(i, 4);
            i += 4;
            oss << endl;
        }
    }
    cout << oss.str() << endl;
    return 0;
}