#include<bits/stdc++.h>
#define int long long
using namespace std;
int T;
int n,a[500005],str[500005];
signed main(){
freopen("gameemag.in","r",stdin);
freopen("gameemag.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>T;
while(T--){
int ans1=0,ans2=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
str[i]=str[i-1]+a[i];
}
int len=n-(n/2-1),minn=1e17;
for(int i=len;i<=n;i++){
minn=min(minn,str[i]-str[i-len]);
}
cout<<minn<<" "<<str[n]-minn<<endl;
}
return 0;
}