#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x,y,a;
int f[N];
bool flag;
//int dp[N][N];
void solve(){
cin>>n;
while(n--){
cin>>a;
if(a%2){
cout<<"0 0";
}else{
cout<<a/4+a%4/2<<" "<<a/2;
}
cout<<"\n";
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}