for _ in range(int(input())): a,b,c,d = map(int,input().split()) if a>b: a,b,c,d = b,a,d,c if c