a,b = -1e11,1e11
for _ in range(int(input())):
    c = int(input())
    a,b = max(a,c-b),min(b,c)
print(a) a,b = -1e11,1e11 a -1e11 b 1e11 for _ in range(int(input())):
    c = int(input())
    a,b = max(a,c-b),min(b,c) _ range(int(input())) range int(input()) int input() input c = int(input()) c int(input()) int input() input a,b = max(a,c-b),min(b,c) a max(a,c-b) max a c-b c b b min(b,c) min b c print(a) print a a,b = -1e11,1e11 -1e11 a b = -1e11,1e11 1e11 b b = max(a,c-b),min(b,c) min(b,c) b c = int(input()) int(input()) c a,b = max(a,c-b),min(b,c) max(a,c-b) a
a,b = -1e11,1e11
for _ in range(int(input())):
    c = int(input())
    a,b = max(a,c-b),min(b,c)
print(a)
