N=int(input()) a=list(map(int,input().split())) for i in range(N): for X in range(N+1): if 2*(X-1) + 4*(N-X) == a[i]: x=X elif 2*X + 4*(N-X-1) == a[i]: x=X print(x,N-x)