There is a famous olympiad, which has more than a hundred participants. The Olympiad consists of two stages: the elimination stage, and the final stage. At least a hundred participants will advance to the final stage. The elimination stage in turn consists of two contests.

A result of the elimination stage is the total score in two contests, but, unfortunately, the jury lost the final standings and has only standings for the first and for the second contest separately. 

In each contest, the participants are ranked by their point score in non-increasing order. When two participants have a tie (earned the same score), they are ranked by their passport number (in accordance with local regulations, all passport numbers are distinct). 

In the first contest, the participant on the 100-th place scored $a$ points. Also, the jury checked all participants from the 1-st to the 100-th place (inclusive) in the first contest and found out that all of them have at least $b$ points in the second contest.

Similarly, for the second contest, the participant on the 100-th place has $c$ points. And the jury checked that all the participants from the 1-st to the 100-th place (inclusive) have at least $d$ points in the first contest.

After two contests, all participants are ranked by their total score in two contests in non-increasing order. When participants have the same total score, tie-breaking with passport numbers is used. The cutoff score to qualify to the final stage is the total score of the participant on the 100-th place.

Given integers $a$, $b$, $c$, $d$, please help the jury determine the smallest possible value of the cutoff score.


-----Input-----

You need to process $t$ test cases.

The first line contains an integer $t$ ($1 \leq t \leq 3025$) — the number of test cases. Then descriptions of $t$ test cases follow.

The first line of each test case contains four integers $a$, $b$, $c$, $d$ ($0 \le a,\,b,\,c,\,d \le 9$; $d \leq a$; $b \leq c$). 

One can show that for any test case satisfying the constraints above, there is at least one olympiad scenario possible.


-----Output-----

For each test case print a single integer — the smallest possible cutoff score in some olympiad scenario satisfying the given information.


-----Example-----
Input
2
1 2 2 1
4 8 9 2

Output
3
12



-----Note-----

For the first test case, consider the following olympiad scenario: there are $101$ participants in the elimination stage, each having $1$ point for the first contest and $2$ points for the second contest. Hence the total score of the participant on the 100-th place is $3$.

For the second test case, consider the following olympiad scenario:   there are $50$ participants with points $5$ and $9$ for the first and second contest respectively;  $50$ participants with points $4$ and $8$ for the first and second contest respectively;  and $50$ participants with points $2$ and $9$ for the first and second contest respectively.  Hence the total point score of the participant on the 100-th place is $12$.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Greedy algorithms


Solutions:
import sys, math
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(a, b, c, d) = inp()
	print(max(a + b, c + d))


def solve():
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))
for _ in range(int(input())):
	solve()


from math import ceil
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	print(max(a + b, c + d))


X = list(map(int, input().split()))
t = X[0]
for i in range(t):
	L = list(map(int, input().split()))
	a = L[0]
	b = L[1]
	c = L[2]
	d = L[3]
	print(max(a + b, c + d))


import math
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(a, b, c, d) = inp()
	ans = max(a + b, c + d)
	out(ans)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict
import bisect

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if a - d >= c - b:
		print(a + b)
	else:
		print(c + d)


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')

def solve():
	(a, b, c, d) = mp()
	x = [a + b, a + c, c + d]
	x.sort(reverse=True)
	pr(x[1])
for _ in range(inp()):
	solve()


import math
t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	res = max(a + b, c + d)
	print(res)


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
for j in range(t):
	m = list(map(int, input().split()))
	a = m[0] + m[1]
	b = m[2] + m[3]
	if a > b:
		print(a)
	else:
		print(b)


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	result = max(a + b, c + d)
	print(result)


from math import ceil
try:
	t = int(input())
	for i in range(t):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
except:
	pass


def cutoff(arr):
	return max(arr[0] + arr[1], arr[2] + arr[3])
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	print(cutoff(arr))


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		(a, b, c, d) = mi()
		print(max(a + b, c + d))
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if a < d:
		print(a + b)
	else:
		print(max(a + b, c + d))


t = int(input())
while t > 0:
	l = input()
	a = int(l.split()[0])
	b = int(l.split()[1])
	c = int(l.split()[2])
	d = int(l.split()[3])
	print(max([a + b, c + d]))
	t = t - 1


t = int(input())
m = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	m.append(max(a + b, c + d))
for u in m:
	print(u)


for n in range(int(input())):
	(a, b, c, d) = [int(i) for i in input().split()]
	t = a + b
	r = c + d
	if t > r:
		print(t)
	else:
		print(r)


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = [int(x) for x in input().split()]
	print(max(a + b, c + d))


ans = []
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	ans.append(max(a + b, c + d))
print(*ans, sep='\n')


def program():
	(a, b, c, d) = [int(x) for x in input().split()]
	print(max(a + b, c + d))
number_of_testcases = int(input())
for i in range(number_of_testcases):
	program()
	print()


t = int(input())
ans = []
for i in range(0, t):
	(a, b, c, d) = list(map(int, input().split()))
	ans.append(max(a + b, c + d))
for ans1 in ans:
	print(ans1)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(a, b, c, d) = get_tuple()
	print(max(a + b, c + d))

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(a, b, c, d) = R()
	print(max(a + b, c + d))


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict
from collections import deque

def solution():
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))
	return

def main():
	testcases = 1
	testcases = int(input())
	for _ in range(testcases):
		solution()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	x = a + b
	y = c + d
	if x >= y:
		print(x)
	else:
		print(y)


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	x1 = a + b
	x3 = d + c
	print(max(x1, x3))


t = int(input())
for a in range(t):
	arr1 = list(map(int, input().strip(' ').split(' ')))
	print(max(arr1[0] + arr1[1], arr1[2] + arr1[3]))


import sys
input = sys.stdin.buffer.readline

def solution():
	(a, b, c, d) = map(int, input().split())
	print(min(max(a + b, c + d), a + c))
t = int(input())
for _ in range(t):
	solution()


import sys
import math
inp = sys.stdin.readlines()
t = int(inp[0])
for i in range(t):
	args = [int(j) for j in inp[i + 1].split()]
	AB = args[0] + args[1]
	BC = args[2] + args[3]
	if AB > BC:
		print(AB)
	else:
		print(BC)


from sys import stdin
rl = stdin.readline

def main():
	t = int(rl())
	cases = [list(map(int, rl().split())) for _ in range(t)]
	for (a, b, c, d) in cases:
		print(max(a + b, c + d))
main()


for _ in range(int(input())):
	(l, m, n, x) = map(int, input().split())
	print(max(l + m, n + x))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	(a, b, c, d) = read()
	print(max(a + b, c + d))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


from sys import stdin, stdout
mp = lambda : map(int, stdin.readline().split())
t = int(input())
for _ in range(t):
	(a, b, c, d) = mp()
	res = max(a + b, c + d)
	print(res)


import sys
import time
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	(a, b, c, d) = mint()
	print(max(a + b, c + d))
start_time = time.time()
for _ in range(iinp()):
	solve()


import sys
import math
import collections
input = sys.stdin.readline
t = int(input())
for w in range(t):
	(a, b, c, d) = (int(i) for i in input().split())
	print(max(a + b, c + d))


t = int(input())
for i in range(t):
	check = 0
	(a, b, c, d) = map(int, input().split())
	if a + b >= c + d:
		print(a + b)
	else:
		print(c + d)


n = int(input())
res = []
for i in range(n):
	balls = list(map(int, input().split(' ')))
	res.append(max(balls[0] + balls[1], balls[2] + balls[3]))
for i in range(n):
	print(res[i])


a = int(input())
m = []
for i in range(a):
	C2 = input()
	C1 = C2.split()
	ad = int(C1[0]) + int(C1[1])
	bc = int(C1[3]) + int(C1[2])
	m.append(max(ad, bc))
for i in m:
	print(i)


def solution(a, b, c, d):
	if a + b == c + d:
		return a + b
	return max(a + b, c + d)
t = int(input())
for tt in range(t):
	(a, b, c, d) = map(int, input().split())
	print(solution(a, b, c, d))


t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	print(max(a + b, c + d))


t = input()
t = int(t)
for i in range(0, t):
	z = input().split()
	x = int(z[0]) + int(z[1])
	y = int(z[2]) + int(z[3])
	if x > y:
		print(x)
	else:
		print(y)


import math
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
for q in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	print(max(a + b, c + d))


def Score(arr):
	return max(arr[0] + arr[1], arr[2] + arr[3])
t = int(input())
for _ in range(t):
	l = [int(i) for i in input().split()]
	print(Score(l))


t = int(input())
answers = []
for j in range(t):
	data = input().split()
	(a, b, c, d) = (int(data[0]), int(data[1]), int(data[2]), int(data[3]))
	if a + b < d + c:
		answers.append(d + c)
	else:
		answers.append(a + b)
for answer in answers:
	print(answer)


x = int(input())
for i in range(x):
	s1 = input()
	(a, b, c, d) = s1.split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	print(max(a + b, c + d))


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	print(max(a + b, c + d))


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
sys.setrecursionlimit(2 * 10 ** 5 + 10)
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
aa = 'abcdefghijklmnopqrstuvwxyz'

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def sol(n):
	seti = set()
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			seti.add(n // i)
			seti.add(i)
	return seti

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
while t:
	t -= 1
	lst = list(map(int, input().split()))
	y = max(lst[0] + lst[1], lst[2] + lst[3])
	print(y)


num = int(input())
for i in range(num):
	num_list = input().split()
	if int(num_list[1]) < int(num_list[2]):
		if int(num_list[2]) + int(num_list[3]) < int(num_list[0]) + int(num_list[1]):
			print(int(num_list[0]) + int(num_list[1]))
		else:
			print(int(num_list[2]) + int(num_list[3]))
	elif int(num_list[1]) == int(num_list[2]):
		print(int(num_list[0]) + int(num_list[1]))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def endline():
	return input()

def main():
	t = inp()
	while t > 0:
		t -= 1
		(a, b, c, d) = invr()
		ans = max(a + b, c + d)
		print(ans)
input = sys.stdin.readline
main()


t = int(input())

def maxim(a, b):
	if a < b:
		return int(b)
	return int(a)

def minim(a, b):
	if a > b:
		return int(b)
	return int(a)
res = []
for i in range(0, t):
	(a, b, c, d) = input().split(' ')
	res.append(maxim(int(a) + int(b), int(c) + int(d)))
for i in res:
	print(i)


ns = lambda : input()
ni = lambda : int(input())
nm = lambda : map(int, input().split())
nl = lambda : list(map(int, input().split()))
for _ in range(ni()):
	(a, b, c, d) = nm()
	print(max(a + b, c + d))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(a, b, c, d) = I()
	an = max(a + b, c + d)
	print(an)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = inar()
		print(max(a + b, d + c))
main()


t = int(input())
b_list = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	a_list = [a] + [b] + [c] + [d]
	result = max(a_list[0] + a_list[1], a_list[2] + a_list[3])
	b_list += [result]
for i in b_list:
	print(i)


for _ in range(int(input())):
	(a, b, c, d) = [int(z) for z in input().split()]
	print(max(a + b, c + d))


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			(a, b, c, d) = invr()
			print(max(a + b, c + d))
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	t = int(input())
	while t > 0:
		(a, b, c, d) = map(int, input().split())
		fir = a + b
		sec = c + d
		print(max(fir, sec))
		t -= 1
main()


import sys
for _ in range(int(sys.stdin.readline())):
	c = list(map(int, sys.stdin.readline().strip().split(' ')))
	print(max(c[0] + c[1], c[2] + c[3]))


x = 0
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	x = max(a + b, c + d)
	print(x)


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	(a, b, c, d) = M()
	print(max(a + b, c + d))


p = int(input())
for t in range(p):
	a = [int(num) for num in input().split(' ')]
	ans = max(a[0] + a[1], a[2] + a[3])
	print(ans)


def main():
	(a, b, c, d) = map(int, input().split())
	f = []
	f += [a + b] * 100
	f += [c + d] * 100
	f.sort()
	print(f[100])
rw = int(input())
for wewq in range(rw):
	main()


for _ in range(int(input())):
	a = list(map(int, input().split()))
	print(max(a[0] + a[1], a[3] + a[2]))


t = int(input())
while t > 0:
	t = t - 1
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	if a + b > c + d:
		ans = a + b
	else:
		ans = c + d
	print(ans)


t = int(input())
for each in range(t):
	(a, b, c, d) = list(map(int, input().split(' ')))
	t1 = a + b
	t2 = c + d
	if t1 <= t2:
		print(t2)
	else:
		print(t1)


t = int(input())
for case in range(t):
	(a, b, c, d) = [int(x) for x in input().split(' ')]
	ans = max(a + b, c + d)
	print(ans)


for _ in range(int(input())):
	(a, b, c, d) = [int(j) for j in input().split()]
	e = a + b
	f = c + d
	if e > f:
		print(e)
	else:
		print(f)


def read_ints():
	return map(int, input().split())
top_size = 100
t = int(input())
for i_t in range(t):
	(a, b, c, d) = read_ints()
	min_sums = [c + d] * top_size + [a + b] * top_size
	result = sorted(min_sums, reverse=True)[top_size - 1]
	print(result)


import math

def solve():
	(a, b, c, d) = [int(s) for s in input().split(' ')]
	ans = max(a + b, c + d)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve(i, t):
	(a, b, c, d) = IP()
	print(max(a + b, c + d))
	return
t = II()
for i in range(t):
	solve(i, t)


a = int(input())
fin = [0] * a
for i in range(a):
	mas = list(map(int, input().split()))
	fin[i] = max(mas[0] + mas[1], mas[2] + mas[3])
for i in range(a):
	print(fin[i])


_39 = '1445b'
a1 = []
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	a1.append(max(a + b, c + d))
for i in a1:
	print(i)


t = int(input())
while t:
	(n, x, a, b) = map(int, input().split())
	print(max(n + x, a + b))
	t -= 1


in1 = int(input())
for i in range(in1):
	in2 = input().split()
	in2 = list(map(int, in2))
	a = in2[0]
	b = in2[1]
	c = in2[2]
	d = in2[3]
	ans = max(a + b, c + d)
	print(ans)


import itertools
import math
import sys
import os
from collections import defaultdict

def is_debug():
	return 'PYPY3_HOME' not in os.environ

def stdin_wrapper():
	data = '2\n1 2 2 1\n4 8 9 2\n\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return input_wrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(a, b, c, d):
	return max(a + b, c + d)
t = get(int)
for _ in range(t):
	(a, b, c, d) = get_arr(int)
	print(*solve(a, b, c, d))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

def RL():
	return map(int, sys.stdin.readline().split())

def RLL():
	return list(map(int, sys.stdin.readline().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	(a, b, c, d) = RL()
	print(max(a + b, c + d))


for _ in [0] * int(input()):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
while t > 0:
	p = list(map(int, input().split()))
	a = p[0]
	b = p[1]
	c = p[2]
	d = p[3]
	print(max(a + b, c + d))
	t -= 1


for s in [*open(0)][1:]:
	(a, b, c, d) = map(int, s.split())
	print(max(a + b, c + d))


def elim(a, b, c, d):
	return max(a + b, c + d)
n = int(input())
res = []
for i in range(n):
	num1 = list(map(int, input().split()))
	res.append(elim(num1[0], num1[1], num1[2], num1[3]))
for j in res:
	print(j)


def main():
	for _ in range(int(input())):
		(a, b, c, d) = [int(x) for x in input().split()]
		print(max(a + b, c + d))
main()


from sys import stdin
input = lambda : stdin.readline().strip()
t = int(input())
for j in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
f = int(stdin.readline())
for i in range(f):
	(a, b, c, d) = map(int, stdin.readline().strip().split())
	arr = [a + b, d + c, a + 1 + c]
	arr.sort()
	print(arr[1])


nbTestCase = int(input())
listPts = []
for i in range(nbTestCase):
	pts = list(map(int, input().split(' ')))
	listPts.append(pts)
for i in range(nbTestCase):
	pts = listPts[i]
	res = max(pts[0] + pts[1], pts[2] + pts[3])
	print(res)


def solve(arr):
	line = arr.split(' ')
	a = int(line[0])
	b = int(line[1])
	c = int(line[2])
	d = int(line[3])
	if a == d or c == b:
		th = a + b
	if b < c or a > d:
		if a + b > c + d:
			th = a + b
		elif a + b < c + d:
			th = c + d
		else:
			th = a + b
	return th
t = int(input())
results = list()
for _ in range(0, t):
	arr = str(input())
	results.append(solve(arr))
for result in results:
	print(result, '\n')


for u in range(int(input())):
	l = list(map(int, input().split()))
	print(max(l[0] + l[1], l[2] + l[3]))


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from math import floor
k = int(input())
while k:
	(a, b, c, d) = map(int, input().split(' '))
	print(max(a + b, d + c))
	k -= 1


t = int(input())
while t > 0:
	a = [int(z) for z in input().split()]
	t -= 1
	print(max(a[0] + a[1], a[2] + a[3]))


import sys, math, bisect
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans
from collections import deque, defaultdict, Counter
import heapq
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	x = a - d
	y = c - b
	print(b + d + max(x, y))


for case in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	scores = []
	for i in range(98):
		scores.append(d + b)
	scores.append(d + c)
	scores.append(a + b)
	scores.sort()
	print(scores[-1])


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	numCases = inp()
	for _ in range(numCases):
		a = inlt()
		print(max(a[0] + a[1], a[2] + a[3]))
main()


import sys
import math
import heapq
from collections import deque
input = sys.stdin.readline

def solve():
	(a, b, c, d) = map(int, input().split())
	return max(a + b, c + d)
for _ in range(int(input())):
	print(solve())


t = int(input())
l = []
for i in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	if a + b > c + d:
		l.append(int(a + b))
	else:
		l.append(int(c + d))
for i in l:
	print(i)


import math
T = int(input())
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	ans = max(a + b, c + d)
	print(ans)


import sys
import os.path
import math
from sys import stdin, stdout
from collections import *
from math import gcd, ceil, floor
mod = int(1000000000.0 + 7)
if os.path.exists('Updated prg/Input3d.txt'):
	sys.stdout = open('Updated prg/Output3d.txt', 'w')
	sys.stdin = open('Updated prg/Input3d.txt', 'r')

def sinp():
	return input()

def ninp():
	return int(sinp())

def mapinp():
	return map(int, sinp().split())

def linp():
	return list(mapinp())

def sl():
	return list(sinp())

def prnt(a):
	print(a)
for _ in range(ninp()):
	l1 = linp()
	s1 = sum(l1[:2])
	s2 = sum(l1[2:])
	prnt(max(s1, s2))


t = int(input())
ans = []
scores = []
if t >= 1 and t <= 3025:
	for i in range(0, t):
		score = [int(i) for i in input().split()]
		scores.append(score)
	for j in range(0, t):
		answer = max(scores[j][0] + scores[j][1], scores[j][2] + scores[j][3])
		ans.append(answer)
	for i in range(0, len(ans)):
		print(ans[i])


t = int(input())
a = [0 for i in range(t)]
b = [0 for i in range(t)]
c = [0 for i in range(t)]
d = [0 for i in range(t)]
z = [0 for i in range(4)]
for i in range(t):
	z = input().split()
	a[i] = int(z[0])
	b[i] = int(z[1])
	c[i] = int(z[2])
	d[i] = int(z[3])
for i in range(t):
	if a[i] + b[i] < c[i] + d[i]:
		print(c[i] + d[i])
	else:
		print(a[i] + b[i])


def eliminate(a, b, c, d):
	return max(a + b, c + d)
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	print(eliminate(a, b, c, d))


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	t = [a + c, a + b, c + d]
	t.sort()
	print(t[1])


t = int(input())
ans = []
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	ans.append(max(a + b, c + d))
for i in ans:
	print(i)


t = int(input())
(aa, bb, cc, dd) = ([], [], [], [])
for i in range(t):
	(a, b, c, d) = input().split()
	aa.append(int(a))
	bb.append(int(b))
	cc.append(int(c))
	dd.append(int(d))
for i in range(t):
	print(str(max(aa[i] + bb[i], cc[i] + dd[i])))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b, c, d) = value()
	print(max(a + b, d + c))


import sys
import os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x, k):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def main():
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
main()


import sys
t = int(input())
for test in range(t):
	[a, b, c, d] = list(map(int, input().split(' ')))
	print(max(a + b, d + c))


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import queue
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def inin():
	return int(input())
for _ in range(inin()):
	(a, b, c, d) = cin()
	print(max(a + b, c + d))


import sys
input = sys.stdin.buffer.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().decode().rstrip('\n\r')
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
xrange = lambda args: reversed(range(args))
cdiv = lambda x, y: -(-x // y)
enum = enumerate
inf = float('inf')
mod = 10 ** 9 + 7
Cases = ri()
for Case in range(Cases):
	(a, b, c, d) = rl()
	print(max(a + b, c + d))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(a, b, c, d) = In()
		print(max(c + d, a + b))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


numOfTest = int(input())
for x in range(numOfTest):
	scores = list(map(int, input().split()))
	print(max(scores[0] + scores[1], scores[2] + scores[3]))


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(a, b, c, d):
	return max(a + b, c + d)
TC = int(input())
for tc in range(TC):
	(a, b, c, d) = map(int, input().split())
	res = solve(a, b, c, d)
	print(res)


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	k = a + b
	m = c + d
	print(max(k, m))


t = int(input())
for i in range(t):
	l = [int(i) for i in input().split()]
	print(max(l[0] + l[1], l[2] + l[3]))


t = int(input())
for i in range(0, t, 1):
	(a, b, c, d) = map(int, input().split())
	mx = max(a + b, c + d)
	print(mx)


import math

def main():
	n = int(input())
	maxes = []
	for i in range(0, n):
		[a, b, c, d] = map(int, input().split())
		maxes.append(max(a + b, c + d))
	for i in range(0, n):
		print(maxes[i])
main()


t = int(input())
i = 0
while i < t:
	n = list(map(int, input().split()))
	FF = n[0] + n[1]
	SF = n[2] + n[3]
	print(max(FF, SF))
	i += 1


for T in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from sys import stdin as stin, stdout as stout, setrecursionlimit as srl
from collections import defaultdict as dd, Counter, deque as dq

def get_ints():
	return map(int, stin.readline().split())

def get_list():
	return list(map(int, stin.readline().split()))

def get_int():
	return int(stin.readline())

def get_str():
	return stin.readline()
for _ in range(get_int()):
	(a, b, c, d) = get_ints()
	print(max(a + b, c + d))


import sys, math
input = sys.stdin.readline
print = sys.stdout.write
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
for _ in range(ri()):
	(a, b, c, d) = rl()
	ans = max(a + b, c + d)
	print('%d\n' % ans)


T = int(input())
for case in range(T):
	(a, b, c, d) = [int(i) for i in input().split(' ')]
	print(max(a + b, c + d))


def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())
for _ in range(ii()):
	(a, b, c, d) = mi()
	print(max(a + b, c + d))


from sys import stdin, stdout

def II():
	return int(stdin.readline())

def MI():
	return map(int, stdin.readline().split())

def solve():
	(a, b, c, d) = MI()
	ans = max(a + b, c + d)
	stdout.write('{} \n'.format(ans))
t = II()
for _ in range(t):
	solve()


def main():
	t = []
	n = int(input())
	for i in range(n):
		num = list(map(int, input().split(' ')))
		(a, b, c, d) = (num[0], num[1], num[2], num[3])
		t.append(max(a + b, c + d))
	for i in range(len(t)):
		print(t[i])
main()


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


def inplst():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b, c, d) = inplst()
	print(max(a + b, c + d))


for i1 in range(int(input())):
	(a, b, c, d) = [int(i) for i in input().split()]
	print(max(a + b, d + c))


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


num = int(input())
ans = 0
for i in range(num):
	list = [int(x) for x in input().split()]
	ans = max(list[0] + list[1], list[2] + list[3])
	print(ans)


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import tee
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b)

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	return rrl()

def solve(a, b, c, d):
	return max(a + b, c + d)
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	rp(result)


def solve():
	(a, b, c, d) = input().split(' ')
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	ans = max(a + b, c + d)
	print(ans)
t = int(input())
for i in range(0, t):
	solve()


import sys
t = int(input().strip())
for a0 in range(t):
	l = [int(i) for i in input().split()]
	print(max(l[0] + l[1], l[2] + l[3]))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24
from decimal import *
from math import *
from operator import or_
s = 0

def solve():
	(a, b, c, d) = sep()
	print(max(a + b, c + d))
testcase(int(inp()))


for _ in range(int(input())):
	l = list(map(int, input().split()))
	print(sum(l[:2]) if sum(l[:2]) > sum(l[2:]) else sum(l[2:]))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_lists():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_strings():
	return sys.stdin.readline().strip()
N = int(input())
while N:
	(a, b, c, d) = get_ints()
	print(max(a + b, c + d))
	N -= 1


def testcase():
	(a, b, c, d) = list(map(int, input().split()))
	ans = max(a + b, c + d)
	print(ans)
	return
import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(10 ** 5)
t = int(input())
for _ in range(t):
	testcase()


for t in range(int(input())):
	(a, b, c, d) = [int(n) for n in input().split()]
	print(max(a + b, c + d))


import sys, os
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve_(a, b, c, d):
	return max(a + b, c + d)

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	pass
ONLINE_JUDGE = False
if os.path.exists('input.txt'):
	ONLINE_JUDGE = True
if ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def console(*args):
		pass

def solve(*args):
	if not ONLINE_JUDGE:
		console('----- solving ------')
		console(*args)
		console('----- ------- ------')
	return solve_(*args)
if True:
	inp = iter(sys.stdin.buffer.readlines())
	input = lambda : next(inp)
else:
	input = sys.stdin.buffer.readline
for case_num in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	res = solve(a, b, c, d)
	print(res)


def ans(a, b, c, d):
	return max(a + b, c + d)
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	print(ans(a, b, c, d))


import sys
import math
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import sys

def solve(k):
	(a, b, c, d) = k
	return max(a + b, c + d)

def readinput():
	tc = int(sys.stdin.readline().rstrip())
	for i in range(tc):
		k = list(map(int, sys.stdin.readline().rstrip().split(' ')))
		print(solve(k))
readinput()


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	e = a + b
	f = c + d
	ans = max(e, f)
	print(ans)


n = int(input())
ans = []
for i in range(n):
	a = list(map(int, input().split()))
	ans.append(max(a[0] + a[1], a[2] + a[3]))
for i in ans:
	print(i)


import sys

def In():
	return sys.stdin.readline()

def Out(x):
	return sys.stdout.write(str(x) + '\n')
t = int(input())
for p in range(t):
	(a, b, c, d) = map(int, In().split())
	Out(max(a + b, c + d))


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for _ in range(n):
	l = inlt()
	a = l[0]
	b = l[1]
	c = l[2]
	d = l[3]
	if a + b > c + d:
		print(a + b)
	else:
		print(c + d)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def solve(lst):
	(a, b, c, d) = lst
	ans = a + c
	if a + b >= c + d:
		ans = min(ans, a + b)
	if c + d >= a + b:
		ans = min(ans, c + d)
	return ans
for _ in range(int(input())):
	lst = list(map(int, input().split()))
	print(solve(lst))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	(a, b, c, d) = sep()
	print(max(a + b, c + d))
testcase(int(inp()))


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()

def main():
	for _ in range(int(I1())):
		(a, b, c, d) = I()
		print(max(a + b, c + d))
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b, c, d) = list(map(int, input().split()))
		yield max(a + b, c + d)
t = int(input())
ans = gift()
print(*ans, sep='\n')


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	res = []
	for (ch, g) in groupby(it):
		res.append((ch, len(list(g))))
	return res
t = N()
for i in range(t):
	(a, b, c, d) = RL()
	print(max(a + b, c + d))


t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	x = a + b
	y = c + d
	print(max(x, y))


import math
import sys, bisect
from heapq import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 6)
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	(a, b, c, d) = neo()
	print(max(a + b, c + d))


def myinput():
	while True:
		str = input()
		if len(str) == 0:
			continue
		return str
t = int(input())
for i in range(t):
	(a, b, c, d) = [int(x) for x in myinput().split()]
	print(max(a + b, c + d))


t = int(input())
for i in range(0, t):
	l1 = [int(x) for x in input().split()]
	a = l1[0]
	b = l1[1]
	c = l1[2]
	d = l1[3]
	print(max(a + b, c + d))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
import string
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	a = li()
	print(max(sum(a[:2]), sum(a[2:])))


try:
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
except:
	pass


n = int(input())
L = []
for i in range(n):
	L.append([int(j) for j in input().split()])
for i in L:
	print(max(i[0] + i[1], i[2] + i[3]))


t = int(input())
for _ in range(t):
	points = [int(number) for number in input().split(' ')]
	print(max(points[0] + points[1], points[2] + points[3]))


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	(a, b, c, d) = get_ints()
	case1 = max(a, d) + min(b, c)
	case2 = max(b, c) + min(a, d)
	print(max(case1, case2))


t = int(input())

def process():
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))
for tt in range(t):
	process()


t = int(input())
while t:
	(a, b, c, d) = list(map(int, input().split()))
	print(max(min(a + b, a + c), c + d))
	t = t - 1


import sys
from math import *
from fractions import *

def main():
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	print(max(a + b, c + d))
for i in range(int(input()) - 1):
	main()
main()


lines = int(input())
for x in range(lines):
	k = input().split()
	results: list = list(map(int, k))
	a = results[0] + results[1]
	b = results[2] + results[3]
	if a > b:
		print(a)
	else:
		print(b)


n = int(input())
output = []
for i in range(n):
	array = list(map(int, input().split()))
	output.append(max(array[0] + array[1], array[2] + array[3]))
for num in output:
	print(num)


import math

def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(a, b, c, d):
	return max(a + b, c + d)
t = readInt()
for i in range(t):
	a = readInt()
	b = readInt()
	c = readInt()
	d = readInt()
	print(solve(a, b, c, d))


from sys import stdin
t = int(stdin.readline())
for test in range(t):
	(a, b, c, d) = map(int, stdin.readline().split())
	print(max(a + b, c + d))


from math import ceil
from collections import defaultdict
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, d + c))


import sys, os.path
from collections import *
from heapq import *
from copy import *
import math
mod = 10 ** 9 + 7
read = lambda : map(int, input().split())
inf = sys.maxsize
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for t in range(int(input())):
	(a, b, c, d) = read()
	print(max(a + b, c + d))


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	sum1 = a + b
	sum2 = c + d
	if sum1 > sum2:
		print(sum1)
	else:
		print(sum2)


def solve():
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


for t in range(int(input())):
	abcd = list(map(int, input().split()))
	print(max(abcd[0] + abcd[1], abcd[2] + abcd[3], abcd[1] + abcd[3]))


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		if _ != t - 1:
			input()
		b.sort(reverse=True)
		a.sort()
		truth = True
		for i in range(n):
			if a[i] + b[i] > x:
				truth = False
				break
		if truth:
			print('Yes')
		else:
			print('No')

def B():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
B()


n = int(input())
lista = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	lista.append(max(a + b, c + d))
for i in range(n):
	print(lista[i])


n = int(input())
for i in range(n):
	(a, b, c, d) = list(input().split(' '))
	print(max(int(a) + int(b), int(c) + int(d)))


for x in range(int(input())):
	case = input().split()
	a = int(case[0])
	b = int(case[1])
	c = int(case[2])
	d = int(case[3])
	print(max(a + b, c + d))


n = int(input())
for j in range(0, n):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


cases = int(input())
for t in range(cases):
	(a, b, c, d) = list(map(int, input().split()))
	if a < d and c < b:
		print(b + d)
	else:
		print(max(a + b, c + d))


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	c = int(l[2])
	d = int(l[3])
	print(max(a + b, c + d))


try:
	test = int(input())
	while test != 0:
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
		test -= 1
except EOFError as e:
	print('')


for i in range(int(input())):
	a = [int(j) for j in input().split()]
	print(max(a[0] + a[1], a[2] + a[3]))


t = int(input())
for c in range(1, t + 1):
	lst = list(map(int, input().split()))
	print(f'{max(lst[0] + lst[1], lst[2] + lst[3])}')


import sys
import math
input = sys.stdin.readline

def get_int():
	return int(input().strip())

def get_int_list():
	return list(map(int, input().strip().split()))

def get_char_list():
	return list(input().strip())
cases = get_int()
for _ in range(cases):
	(a, b, c, d) = get_int_list()
	print(max(a + b, c + d))


for i in range(int(input())):
	(A, B, C, D) = map(int, input().split())
	print(max(A + B, C + D))


n = int(input())
for i in range(1, n + 1, 1):
	(a, b, c, d) = input().split()
	x = int(a) + int(b)
	y = int(c) + int(d)
	if x == y:
		print(x)
	else:
		print(max(x, y))


import sys
from array import array
from typing import List, Tuple, TypeVar, Generic, Sequence, Union

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		print(max(a + b, c + d))
main()


n = int(input())
for i in range(n):
	s = input().split(' ')
	print(max(int(s[0]) + int(s[1]), int(s[2]) + int(s[3])))


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
for _ in range(INI()):
	(a, b, c, d) = INL()
	OPS(max(a + b, c + d))


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
for _ in range(II()):
	(a, b, c, d) = MI()
	print(max(a + b, c + d))


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
from itertools import permutations, combinations

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
for t in range(int(data())):
	(a, b, c, d) = mdata()
	out(max(a + b, c + d))


import math
t = int(input())
for i in range(t):
	l = input().split(' ')
	a = int(l[0])
	b = int(l[1])
	c = int(l[2])
	d = int(l[3])
	print(max(a + b, c + d))


cases = int(input())
while cases:
	cases -= 1
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
from math import sqrt
t = I()
for _ in range(t):
	(a, b, c, d) = tup()
	print(max(a + b, c + d))


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k, modulus=1):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
		res %= modulus
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(a, b, c, d) = int_array()
	print(max(a + b, c + d))


def compute(a):
	print(max(a[0] + a[1], a[2] + a[3]))
q = int(input())
for q_itr in range(q):
	a = list(map(int, input().rstrip().split()))
	compute(a)


import sys
import math

def scan(input_type='int'):
	if input_type == 'int':
		return list(map(int, sys.stdin.readline().strip().split()))
	else:
		return list(map(str, sys.stdin.readline().strip()))

def solution():
	for _ in range(int(input())):
		(a, b, c, d) = scan()
		print(max(a + b, c + d))
solution()


import math
t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	print(max(l[0] + l[1], l[2] + l[3]))


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(a, b, c, d) = MI()
	print(max(a + b, c + d))


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	z = a + b
	x = c + d
	print(max(z, x))


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	(a, b, c, d) = R()
	print(max(a + b, c + d))


t = int(input())
while t > 0:
	(a, b, c, d) = [int(x) for x in input().split()]
	if a + b >= c + d:
		print(a + b)
	else:
		print(c + d)
	t -= 1


(I, n) = (lambda : map(int, input().split()), int(input()))
for i in range(n):
	a = list(I())
	print(max(a[0] + a[1], a[2] + a[3]))


import math
t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))
	t = t - 1


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	e = a + b
	f = c + d
	k = max(e, f)
	print(k)


def solve():
	(a, b, c, d) = [int(x) for x in input().strip().split()]
	return max(a + b, c + d)
for _ in range(int(input().strip())):
	print(solve())


class Solution:

	def __init__(self):
		self.found = -1
		self.pattern = []
		self.three = 0
		self.five = 0
		self.seven = 0

	@staticmethod
	def cutoffScore(a, b, c, d):
		sum1 = a + b
		sum2 = c + d
		if sum1 > sum2:
			return sum1
		return sum2
num = int(input())
while num:
	(a, b, c, d) = list(map(int, input().split()))
	val = Solution.cutoffScore(int(a), int(b), int(c), int(d))
	print(val)
	num -= 1


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(a, b, c, d) = map(int, inputi().split())
	print(max(a + b, c + d))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


t = int(input())
outputs = [0] * t
for i in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	outputs[i] = max(a + b, c + d)
for out in outputs:
	print(out)


import math

def solve(a, b, c, d):
	return max(a + b, c + d)
t = int(input())
for _ in range(t):
	(a, b, c, d) = tuple(map(int, input().split()))
	print(solve(a, b, c, d))


for _ in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split(' ')]
	if c + d > a + b:
		print(c + d)
	else:
		print(a + b)


t = int(input())
for i in range(t):
	nums = [int(i) for i in input().split()]
	(a, b, c, d) = (nums[0], nums[1], nums[2], nums[3])
	worst_1 = a + b
	worst_2 = c + d
	print(max([worst_1, worst_2]))


from sys import stdin, stdout

def main():
	for __ in range(int(input())):
		A = [int(num) for num in input().split()]
		print(max(A[0] + A[1], A[2] + A[3]))
main()


T = int(input())
while T:
	(a, b, c, d) = map(int, input().split())
	ans = max(a + b, c + d)
	print(ans)
	T -= 1


num = int(input())
for i in range(num):
	arr = input().split()
	arr = list(map(int, arr))
	print(max(arr[0] + arr[1], arr[2] + arr[3]))


for q in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	r1 = a + b
	r2 = c + d
	print(max(r1, r2))


def read_generator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = read_generator()

def readword():
	return next(reader)

def readint():
	return int(next(reader))

def readfloat():
	return float(next(reader))

def readline():
	return input()

def solve(a, b, n):
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
tests = readint()
for t in range(tests):
	(a, b, c, d) = (readint(), readint(), readint(), readint())
	print(max(a + b, c + d))


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b, c, d) = get_ints()
	print(max(a + b, c + d))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(a, b, c, d) = ria()
		print(max(a + b, c + d))
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	a1 = min(a, d)
	a2 = min(b, c)
	b1 = max(a, d)
	b2 = max(b, c)
	print(max(a1 + b2, b1 + a2))


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	p = c + d
	q = a + b
	print(max(p, q))


a = int(input())
for i in range(a):
	l = list(map(int, input().split()))
	print(max(l[0] + l[1], l[2] + l[3]))


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
from heapq import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	(a, b, c, d) = ma()
	print(max(a + min(b, c), c + min(a, d)))


import os
import sys
from io import BytesIO, IOBase

def main():
	for tc in range(int(input())):
		line = input().split()
		(a100, b, b100, a) = (int(line[0]), int(line[1]), int(line[2]), int(line[3]))
		print(max(a100 + b, b100 + a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import os
import sys
from io import BytesIO, IOBase
_str = str
BUFSIZE = 8192

def str(x=b''):
	return x if type(x) is bytes else _str(x).encode()

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def inp():
	return sys.stdin.readline().rstrip()

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())

def solve():
	(a, b, c, d) = mpint()
	return max(a + b, b + d, c + d)

def main():
	for _ in range(itg()):
		print(solve())
DEBUG = 0
URL = 'https://codeforces.com/contest/1445/problem/B#'
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
elif DEBUG == 2:
	main()
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	main()


t = int(input())
ans = []
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	if d < a:
		(a, d) = (d, a)
	if c < b:
		(b, c) = (c, b)
	ret = max(b + d, a + c)
	ans.append(str(ret))
print('\n'.join(ans))


test = int(input())
for q in range(test):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


import sys
from copy import *
from bisect import *
from math import gcd, ceil, sqrt
from itertools import permutations as prm, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	(a, b, c, d) = mi()
	print(max(a + b, c + d))


T = int(input())
for __ in range(T):
	(a, b, c, d) = map(int, input().split())
	if a - d >= c - b:
		print(a + b)
	else:
		print(c + d)


t = int(input())
for q in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(a, b, c, d) = (L[0], L[1], L[2], L[3])
	print(max(a + b, c + d))


T = int(input())
for _ in range(T):
	lst = list(map(int, input().split()))
	print(max(lst[0] + lst[1], lst[2] + lst[3]))


t = int(input())
for i in range(0, t):
	sp = input().split()
	sp = list(map(int, sp))
	c = sp[0] + sp[1]
	d = sp[2] + sp[3]
	if c > d:
		print(c)
	else:
		print(d)


t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	cutoff = 0
	first = a + b
	second = c + d
	if first > second:
		print(first)
	else:
		print(second)
	t -= 1


def solve():
	lst = input()
	lst = lst.split()
	for i in range(len(lst)):
		lst[i] = int(lst[i])
	print(max(lst[0] + lst[1], lst[2] + lst[3]))
t = int(input())
while t > 0:
	solve()
	t = t - 1


T = int(input())
for t in range(T):
	st = input().split()
	a = int(st[0])
	b = int(st[1])
	c = int(st[2])
	d = int(st[3])
	print(max(a + b, c + d))


import bisect
import math

def solve(a, b, c, d):
	p = 10 ** 9 + 7
	return max(a + b, c + d)
	pass
t = int(input())
ans = []
for i in range(t):
	arr = [int(x) for x in input().split()]
	a = arr[0]
	b = arr[1]
	c = arr[2]
	d = arr[3]
	ans.append(solve(a, b, c, d))
for test in ans:
	print(test)


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	l = list(map(int, stdin.readline().split()))
	print(max(l[0] + l[1], l[2] + l[3]))


for loop in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	first = a + b
	second = c + d
	print(max(first, second))


from functools import reduce
import collections
import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		(a, b, c, d) = Read.list_int()
		print(max(a + b, c + d))
main()


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(A, B, C, D) = getInts()
	return max(A + B, C + D)
for _ in range(getInt()):
	print(solve())


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	p = [a + c, a + b, d + c, d + b]
	p.sort()
	print(p[2])


n = int(input())
for i in range(n):
	results = input().split()
	a = int(results[0])
	b = int(results[1])
	c = int(results[2])
	d = int(results[3])
	print(max(a + b, c + d))


t = int(input())
mas = []
for k in range(t):
	(a, b, c, d) = map(int, input().split())
	ans = 0
	if a + b == c + d:
		ans = a + b
	else:
		ans = max(a + b, c + d)
	mas.append(ans)
for i in range(t):
	print(mas[i])


t = int(input())
while t:
	data = input()
	data_list = data.split()
	a = int(data_list[0])
	b = int(data_list[1])
	c = int(data_list[2])
	d = int(data_list[3])
	result = max(a + b, d + c)
	print(result)
	t -= 1


x = input()
y = list()
for elem in range(int(x)):
	l = input()
	y.append(l)

def get_ans(string):
	(a, b, c, d) = string.split()
	return max(int(a) + int(b), int(c) + int(d))
for elem in y:
	print(get_ans(elem))


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))
(t,) = I()
for t1 in range(t):
	(a, b, c, d) = I()
	print(max(a + b, c + d))


tcs = int(input())
for tc in range(tcs):
	(a, b, c, d) = list(map(int, input().split()))
	print(max(a + b, c + d))


import sys
import itertools as it
import math as mt
import bisect as bi
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b, c, d) = I()
	print(max(a + b, c + d))


T = int(input())
for z in range(T):
	a = [int(c) for c in input().split()]
	print(max(a[0] + a[1], a[2] + a[3]))


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(inp())
for _ in range(t):
	(a, b, c, d) = multi()
	print(max(a + b, c + d))


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	m1 = a + b
	m2 = c + d
	print(max(m1, m2))


t = int(input())
result = []
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	result.append(max(a + b, c + d))
for i in result:
	print(i)


k = int(input())
for i in range(k):
	arr = list(map(int, input().split()))
	a = arr[0] + arr[1]
	b = arr[2] + arr[3]
	print(a if a > b else b)


from collections import defaultdict
t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	print(max(a + b, c + d))


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	(a, b, c, d) = list(map(int, sys.stdin.readline().strip().split(' ')))
	if a + b > c + d:
		print(a + b)
	else:
		print(c + d)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
for i in l:
	if i[0] + i[1] == i[2] + i[3]:
		print(i[0] + i[1])
	elif i[0] + i[1] > i[2] + i[3]:
		print(i[0] + i[1])
	else:
		print(i[2] + i[3])


def solve(abcd):
	a = abcd[0]
	b = abcd[1]
	c = abcd[2]
	d = abcd[3]
	return max(a + b, c + d)
t = int(input())
for i in range(t):
	abcd = list(map(int, input().strip().split()))[:4]
	print(solve(abcd))


T = int(input())
for _ in range(0, T):
	(a, b, c, d) = map(int, input().split())
	ans = max(a + b, c + d)
	print(ans)


def elimination(a):
	return max(a[0] + a[1], a[2] + a[3])
x = int(input())
m = []
for i in range(x):
	y = input()
	z = y.split(' ')
	k = [int(t) for t in z]
	m.append(k)
for j in range(x):
	print(elimination(m[j]))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
for i in range(t):
	(a, b, c, d) = (int(x) for x in input().strip().split())
	print(max(a + b, c + d))


inp = lambda : int(input())
strl = lambda : list(input().strip())
seq = lambda : list(map(int, input().strip().split()))

def f(arr):
	(a, b, c, d) = (arr[0], arr[1], arr[2], arr[3])
	return max(c + d, a + b)

def main():
	t = inp()
	for _ in range(t):
		a = seq()
		result = f(a)
		print(result)
main()


for k in range(int(input())):
	(a, b, c, d) = input().split()
	(a, b, c, d) = (int(a), int(b), int(c), int(d))
	if a + b >= c + d:
		print(a + b)
	else:
		print(c + d)


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B, C, D):
	return max(A + B, C + D)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(A, B, C, D) = [int(x) for x in input().split()]
	ans = solve(A, B, C, D)
	print(ans)


t = int(input())

def solve():
	(a, b, c, d) = list(map(int, input().split()))
	print(max(a + b, c + d))
for i in range(t):
	solve()


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


def solve(a, b, c, d):
	return max(max(a, d) + min(b, c), max(b, c) + min(a, d))
t = int(input())
testcases = []
for k in range(t):
	a = [int(i) for i in input().split(' ')]
	testcases.append(a)
r = []
for c in testcases:
	r.append(solve(*c))
for v in r:
	print(v)


t = int(input())
for _ in range(t):
	arr = list(map(int, input().split()))
	res1 = arr[0] + arr[1]
	res2 = arr[2] + arr[3]
	print(max(res1, res2))


t = int(input())
for T in range(t):
	A = list(map(int, input().split()))
	x1 = A[0] + A[1]
	x2 = A[2] + A[3]
	print(max(x1, x2))


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	values = []
	values.append(a + b)
	values.append(c + d)
	values.append(a + 1 + c)
	values.sort(reverse=True)
	print(values[1])


t = int(input())
for i in range(t):
	a = input()
	A = a.split()
	for i in range(4):
		A[i] = int(A[i])
	if A[0] + A[1] > A[2] + A[3]:
		print(A[0] + A[1])
	else:
		print(A[2] + A[3])


t = int(input())
for i in range(0, t):
	(a, b, c, d) = map(int, input().split())
	First = a + b
	Second = c + d
	Max = max(First, Second)
	print(Max)


t = int(input())
for i in range(t):
	nums = [int(x) for x in input().split()]
	if nums[0] + nums[1] >= nums[2] + nums[3]:
		print(nums[0] + nums[1])
	else:
		print(nums[2] + nums[3])


results = []

def solve():
	(a, b, c, d) = map(int, input().split())
	result = max(a + b, c + d)
	results.append(result)
numberOfTasks = int(input())
for i in range(numberOfTasks):
	solve()
for res in results:
	print(res)


t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	if a + b >= c + d:
		print(a + b)
	else:
		print(c + d)


import math
import sys

def chek(m, b, c, li):
	for i in range(li):
		if m[i] + b[i] > c:
			return False
	return True
input = lambda : sys.stdin.readline().rstrip()
f = int(input())
for _ in range(f):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


t = int(input())
while t:
	(a, b, c, d) = [int(x) for x in input().split()]
	x = [a + b, c + d, a + c]
	x.sort()
	print(x[1])
	t -= 1


t = int(input(''))
cases = []
for i in range(t):
	L = [int(x) for x in input('').split()]
	cases.append(L)
for case in cases:
	n = case[0] + case[1]
	m = case[2] + case[3]
	print(max(n, m))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b, c, d) = li()
	print(max(a + b, c + d))


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	x1 = min(a, d)
	x2 = min(b, c)
	x3 = max(a, d)
	x4 = max(b, c)
	print(max(x1 + x4, x2 + x3))


t = int(input())
for k in range(t):
	l = list(map(int, input().split()))
	print(max(l[0] + l[1], l[2] + l[3]))


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(a + b, c + d))


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
tt = vary(1)
for tc in range(tt):
	(a, b, c, d) = vary(4)
	print(max(a + b, c + d))