
int main(void){
  int n,x,y,nx,ny,max,mx,my,tmp;

  scanf("%d",&n);
  while(n--){
    nx=ny=max=0;
    while(1){
      scanf("%d%d",&x,&y);
      if(!x && !y) break;

      nx+=x,ny+=y;
      tmp = nx*nx+ny*ny;
      if(max<tmp){
        max = tmp;
        mx=nx,my=ny;
      }
      else if(max==tmp && mx<nx){
        max = tmp;
        mx=nx,my=ny;
      }
    }
    printf("%d %d\n",mx,my);
  }

  return 0;
}