def bandito(n,m,l,r):
  if n == m: 
    print(l,r)
    return
  if(m <= r): 
    print(0,m)
    return 
  print(-(m-r), r)
 
def main():
  t = int(input())
  for i in range(t):
    n,m,l,r = map(int, input().split())
    bandito(n,m,l,r)
main()