CodeEff/ECCO huggingface dataset:
# Original solution
N=int(eval(input()))
L=[int(eval(input())) for i in range(N)]
index1=L.index(max(L))
index2=L.index(sorted(L)[-2])
for i in range(N-1):
	if i==index1:
		print((sorted(L)[-2]))
	print((max(L)))

# Optimized solution
N=int(eval(input()))
L=[int(eval(input())) for i in range(N)]
tl=sorted(L)
index1=L.index(tl[-1])
index2=L.index(tl[-2])
for i in range(N):
	if i==index1:
		print((L[index2]))
	else:
		print((L[index1]))
# Original solution
n,*a = list(map(int,open(0).read().split()))
b = sorted(a)
max = b[-1]
maxs= b[-2]

for i in range(n):
    if a[i] == max:
        print(maxs)
    else:
        print(max)


# Optimized solution
def main():

    n,*a = list(map(int,open(0).read().split()))
    b = sorted(a)
    max = b[-1]
    maxs= b[-2]

    for i in range(n):
        if a[i] == max:
            print(maxs)
        else:
            print(max)
    return()

if __name__=='__main__':
    main()
# Original solution
N = int(eval(input()))
a = []
for i in range(0, N):
  a.append(int(eval(input())))

first_max = max(a)

former_arr = [0] + a[0:a.index(first_max)]
latter_arr = [0] + a[a.index(first_max) + 1:]
second_max = (max(max(former_arr), max(latter_arr)))

for i in range(0, N):  
  if (a.index(first_max) == i):
    print(second_max)
  else:
    print(first_max)

# Optimized solution
N = int(eval(input()))
a = []
for i in range(0, N):
  a.append(int(eval(input())))

first_max = max(a)

former_arr = [0] + a[0:a.index(first_max)]
latter_arr = [0] + a[a.index(first_max) + 1:]
second_max = (max(max(former_arr), max(latter_arr)))

ans = ""
ans += (str(first_max) + '\n') * (a.index(first_max))
ans += (str(second_max) + '\n')
ans += (str(first_max) + '\n') * (N - a.index(first_max) - 1)
print((ans.rstrip('\n')))
# Original solution
n = int(eval(input()))
a = list()
for x in range(n):
    a.append(int(eval(input())))

for x in range(n):
    tmp = a.pop(x)
    print((max(a)))
    a.insert(x, tmp)


# Optimized solution
n = int(eval(input()))
a = list()
for x in range(n):
    a.append(int(eval(input())))

copy_a = sorted(a, reverse=True)

A_Max = copy_a[0]
A_Second = copy_a[1]

for x in range(n):
    if a[x] == A_Max:
        print(A_Second)
    else:
        print(A_Max)
# Original solution
n=int(eval(input()))

import heapq
a=[]
a_heap=[]
for i in range(n):
    tmp=int(eval(input()))
    a.append(tmp)
    heapq.heappush(a_heap,(-1)*tmp)

for i in range(n):
    max_1=heapq.heappop(a_heap)
    if max_1==(-1)*a[i]:
        max_2=heapq.heappop(a_heap)
        print(((-1)*max_2))
        heapq.heappush(a_heap,max_2)
    else:print(((-1)*max_1))
    heapq.heappush(a_heap,max_1)

# Optimized solution
n=int(eval(input()))

a=[]
a_sort=[]
for i in range(n):
    tmp=int(eval(input()))
    a.append(tmp)
    a_sort.append(tmp)
a_sort.sort(reverse=True)

for i in range(n):
    if a_sort[0]==a[i]:print((a_sort[1]))
    else:print((a_sort[0]))
# Original solution
N = int(eval(input()))

A = []
for i in range(N):
    A.append(int(eval(input())))

B = []
for i in range(N):
    B = A[:i] + A[i+1:]
    #print(B)
    print((max(B)))

# Optimized solution
N = int(eval(input()))

A = []
for i in range(N):
    A.append(int(eval(input())))
    
B = sorted(A,reverse = True)

for i in A:
    if i == B[0]:
        print((B[1]))
    else:
        print((B[0]))
# Original solution
import copy 
n = int(eval(input()))
        
a = [int(eval(input())) for _ in range(n)]
        
for i in range(n):
  temp = copy.deepcopy(a)
  temp[i] = 0
  print((max(temp)))

# Optimized solution
n = int(eval(input()))
        
a = [(int(eval(input())), i) for i in range(n)]
a.sort()
max_, max_index = a[-1]

for i in range(n):
  if i != max_index:
  	print(max_)
  else:
  	print((a[-2][0]))
# Original solution
import copy

n = int(eval(input()))
arr = [int(eval(input())) for _ in range(n)]
ans = []

for ele in arr:
    tmp = copy.copy(arr)
    tmp.remove(ele)
    print((max(tmp)))


# Optimized solution
n = int(eval(input()))
arr = [int(eval(input())) for _ in range(n)]
ar = sorted(arr)
mx = ar[-1]
sc = ar[-2]

for ele in arr:
    if ele == mx:
        print(sc)
    else:
        print(mx)
# Original solution
import copy
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_max = max(a)
for i in range(n):
    if a_max == a[i]:
        a_ = copy.deepcopy(a)
        del a_[i]
        print((max(a_)))
    else:
        print(a_max)


# Optimized solution
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a_sorted = sorted(a)
a_max = a_sorted[-1]
a_sec = a_sorted[-2]
for i in range(n):
    if a_max == a[i]:
        print(a_sec)
    else:
        print(a_max)
# Original solution
N = int(eval(input()))
A = []
t = 0
for i in range(N):
    A.append(int(eval(input())))
while t != N:
    B = [0] * N
    for i in range(N):
        if t != i:
            B[i] = A[i]
    print((max(B)))
    t += 1


# Optimized solution
N = int(eval(input()))
A = []
B = [0] * N
for i in range(N):
    A.append(int(eval(input())))
max = max(A)
B = sorted(A, reverse = True)
count = A.count(max)
if count > 1:
    for i in range(N):
        print(max)
else:
    for i in range(N):
        if A[i] != max:
            print(max)
        else:
            print((B[1]))
# Original solution
import copy
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]

for i in range(n):
    a_ = copy.copy(a)
    a_.pop(i)
    print((max(a_)))

# Optimized solution
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_ = sorted(a)
a_max = a_[-1]
a_sec = a_[-2]
for i in range(n):
    if a[i] == a_max:
        print(a_sec)
    else:
        print(a_max)
# Original solution
import copy


def main():
    n = int(eval(input()))
    a = []
    for _ in range(n):
        a.append(int(eval(input())))
    for i in range(len(a)):
        b = copy.deepcopy(a)
        b.pop(i)
        print((max(b)))


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    a = []
    for _ in range(n):
        a.append(int(eval(input())))
    b = sorted(a)
    for i in range(len(a)):
        if a[i] == b[-1]:
            print((b[-2]))
        else:
            print((b[-1]))


if __name__ == "__main__":
    main()
# Original solution
n = int(input())
nums = [input() for i in range(n)]
m = max(nums)
m2 = sorted(nums)[-2]

[print(m) if nums.count(m) >=2 or nums[i] != m else print(m2) for i in range(n)]


# Optimized solution
n = int(input())
nums = [int(input()) for i in range(n)]
m = max(nums)
m2 = sorted(nums)[-2]
[print(m) if nums[i] != m else print(m2) for i in range(n)]
# Original solution
import copy

n = int(eval(input()))
a_list = []
out_list = []

for i in range(n):
    a_list.append(int(eval(input())))

is_max = False
#print(a_list)    
for i in range(n):
    if not is_max:
        a_copy = copy.copy(a_list)
        a_copy.pop(i)
        #print(a_copy)
        a_max = max(a_copy)
        #print(a_max)
        out_list.append(a_max)
        if a_list[i] == a_max:
            is_max = True
            out_list += [a_max for i in range(n-i-1)]
#print(out_list)        
print(("\n".join(map(str, out_list))))

# Optimized solution

n = int(eval(input()))
a = []

for i in range(n):
    a.append(int(eval(input())))
    
a_copy = list(a)
a.sort(reverse=True)

max_1 = a[0]
max_count = a.count(max_1)

for i in a:
    if i < max_1:
        max_2 = i
        break
        
for a in a_copy:
    if a == max_1 and max_count == 1:
        print(max_2)
    else:
        print(max_1)
# Original solution
import copy
n = int(eval(input()))
a = [0]*n
for i in range(n):
    a[i] = int(eval(input()))
b = copy.deepcopy(a)
amax = max(a)
b.remove(amax)
amax2 = max(b)
for i in range(n):
    if a[i] == amax:
        print(amax2)
    else:
        print(amax)


# Optimized solution
n = int(eval(input()))
a = [0]*n
for i in range(n):
    a[i] = int(eval(input()))
amax = sorted(a)[-1]
amax2 = sorted(a)[-2]
for i in range(n):
    if a[i] == amax:
        print(amax2)
    else:
        print(amax)
# Original solution
import copy
N = int(eval(input()))
A_ = [int(eval(input())) for _ in range(N)]

for i in range(N):
    A = copy.copy(A_)
    A.pop(i)
    print((max(A)))

# Optimized solution
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_ = sorted(A)
max1 = A_[-1]
max2 = A_[-2]

for i in range(N):
    if A[i] == max1:
        print(max2)
    else:
        print(max1)
# Original solution
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]

m = max(a)
count = a.count(m)

if count != 1:
    for i in range(n):
        print(m)

else:
    switch = 0
    for i in range(n-1):
        if a[i] == m:
            a.remove(m)
            m2max = max(a)
            print(m2max)
            a.append(m)
            switch = 1
        else:
            print(m)
    
    if switch == 1:
        print(m)
    else:
        a.remove(m)
        m2max = max(a)
        print(m2max)

# Optimized solution
n=int(eval(input()))
s=[int(eval(input())) for _ in range(n)]
lst=sorted(s,reverse=True)
max1=lst[0]
max2=lst[1]
for i in range(n):
    if s[i]==max1:
        print(max2)
    else:
        print(max1)
# Original solution
N = int(eval(input()))
list_A = []

for _ in range(N):
    A = int(eval(input()))
    list_A.append(A)
    
A = max(list_A)
index_A = list_A.index(A)

for i in range(N):
    if list_A[i] == A:
        list_A[i] = 0
        print((max(list_A)))
        list_A[i] = A
    else:
        print(A)

# Optimized solution
N = int(eval(input()))
list_A = []

for _ in range(N):
    A = int(eval(input()))
    list_A.append(A)
    
A = max(list_A)
index_A = list_A.index(A)

list_B = sorted(list_A, reverse=True)
B = list_B[1]

for i in range(N):    
    if list_A[i] == A:
        print(B)
    else:
        print(A)
# Original solution
#c
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
import copy
ans = []
a_max = max(a)
for i in range(len(a)):
    if a[i]==a_max:
        tmp = copy.deepcopy(a)
        tmp.pop(i)
        print((max(tmp)))
    else:
        print(a_max)

# Optimized solution
#c
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a, reverse=True)
a_max = b[0]
for i in range(len(a)):
    if a[i] == a_max:
        print((b[1]))
    else:
        print(a_max)
# Original solution
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = []
for i in range(n):
    b = sorted(a.copy(), reverse=True)
    if a[i] == b[0]:
        print((b[1]))
    else:
        print((b[0]))


# Optimized solution
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a.copy(), reverse=True)
for i in range(n):
    if a[i] == b[0]:
        print((b[1]))
    else:
        print((b[0]))
# Original solution
import copy

N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]

B = copy.copy(A) # B=AとするだけではAを変更した時にBも変更してしまう
for i in range(N):
    A[i] = 0
    print((max(A)))
    A[i] = B[i]

# Optimized solution
#import copy

N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]

B = sorted(A, reverse=True)
m1 = B[0]
m2 = B[1]

for i in range(N):
    if A[i] == m1:
        print(m2)
    else:
        print(m1)

"""
# TLE
B = copy.copy(A) # B=AとするだけではAを変更した時にBも変更してしまう
for i in range(N):
    A[i] = 0
    print(max(A))
    A[i] = B[i]
"""
# Original solution
n = int(eval(input()))
l = [int(eval(input())) for i in range(n)]
for i in l:
  if i == max(l):
    print((sorted(l)[-2]))
  else:
    print((max(l)))


# Optimized solution
n = int(eval(input()))
l = [int(eval(input())) for i in range(n)]
a = max(l)
b = sorted(l)[-2]
for i in l:
  print((b if i == a else a))
# Original solution
import copy
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
ex_a = []
for i in range(n):
  ex_a = copy.deepcopy(a)
  ex_a[i] = -1
  print((max(ex_a)))

# Optimized solution
#import copy
# 最大値が2つ以上あるものと1つしかないもので場合分けをする
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
if b[-1] == b[-2]:
  for i in range(n):
    print((b[-1]))
else:
  p = a.index(b[-1])
  for i in range(n):
    if i == p:
      print((b[-2]))
    else:
      print((b[-1]))
#deepcopy is so slow!!
# ex_a = []
# for i in range(n):
#   ex_a = copy.deepcopy(a)
#   ex_a[i] = -1
#   print(max(ex_a))
# Original solution
from copy import copy
from collections import deque

N = int(eval(input()))

A = [None]*N

for i in range(N):
    A[i] = int(eval(input()))

Asorted = deque(sorted(A))
    
for i in range(N):
    Ai = A[i]
    Asortedcopy = copy(Asorted)
    Amax = Asortedcopy.pop()
    if Amax == Ai:
        Amax = Asortedcopy.pop()
    print(Amax)


# Optimized solution
from copy import copy
from collections import deque

N = int(eval(input()))

A = [None]*N
Adict = {}
for i in range(N):
    Ai = int(eval(input()))
    A[i] = Ai
    Adict[i] = Ai

Asorted = deque(sorted(A))
first = Asorted.pop()
second = Asorted.pop()

for i in range(N):
    Ai = Adict[i]
    Amax = first
    if Amax == Ai:
        Amax = second
    print(Amax)
# Original solution
import heapq
N = int(input().strip())
a = [list([int(x)*(-1) for x in input().split()]) for i in range(N)]

for i in range(N):
    tmp=a[:i]+a[i+1:]
    heapq.heapify(tmp)
    ans=heapq.heappop(tmp)[0]*(-1)
    print(ans)

# Optimized solution
N = int(input().strip())
a = [int(input().strip()) for i in range(N)]

a_s=sorted(a,reverse=True)
mx=a_s[0]
for i, val in enumerate(a):
    if val!=mx:
        print(mx)
    else:
        print((a_s[1]))
# Original solution
import copy
n = int(eval(input()))
a = list(map(int,[eval(input()) for i in range(n)]))
a_copy = copy.copy(a)

for i in range(n):
  a=copy.copy(a_copy)
  a.remove(a[i])
  print((max(a)))

# Optimized solution
N = int(eval(input()))
A = []
for i in range(N):
    A.append(int(eval(input())))
max_A = max(A)
max_num = 0
for i in range(N):
    if A[i] == max_A:
        # 最大値が複数ある場合の計算削減
        max_num += 1
        if max_num > 1:
            print(max_A)
        else:
            print((max(A[:i] + A[i + 1:])))
    else:
        print(max_A)
# Original solution
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]

for i in range(N):
    A_copy = A[:]
    removed_A = A_copy.pop(i)
    print((max(A_copy)))


# Optimized solution
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
sorted_A = sorted(A[:])

for i in range(N):
    if A[i] == sorted_A[-1]:
        print((sorted_A[-2]))
    else:
        print((sorted_A[-1]))
# Original solution
n = int(eval(input()))
array = []

for i in range(n):
    array.append(int(eval(input())))

m = max(array)
c = array.count(m)

for e in array:
    sa = array[:]
    if e != m:
        print(m)
    else:
        if 1 < c:
            print(m)
        else:
            sa.remove(m)
            print((max(sa)))


# Optimized solution
n = int(eval(input()))
array = []

for i in range(n):
    array.append(int(eval(input())))

m = max(array)
c = array.count(m)
sa = array[:]
sa.remove(m)
m2 = max(sa)

for e in array:

    if e != m:
        print(m)
    else:
        if 1 < c:
            print(m)
        else:
            print(m2)
# Original solution
N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
A_sub = A.copy()
A_sub.sort(reverse=True)
#print(A)

for i in range(N):
    # print(A[i])
    A_sub2 = A_sub.copy()
    A_sub2.remove(A[i])
    print((A_sub2[0]))
    


# Optimized solution
N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
A_sub = A.copy()
MAX = max(A)
A_sub.remove(MAX)
MAX2 = max(A_sub)

for i in range(N):
    if A[i] < MAX:
        print(MAX)
    elif A[i] == MAX:
        print(MAX2)
# Original solution
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]

ans = []
front_max_list, back_max_list = [0], [0]

for i in range(N):
    front_max_list.append(max(front_max_list[i], A[i]))
    back_max_list.append(max(back_max_list[i], A[N - i - 1]))

for i in range(N):
    print((max(front_max_list[i], back_max_list[N - i - 1])))


# Optimized solution
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]

A_ = sorted(A.copy(), reverse=True)
max_num = [A_[0], A_[1]]

for i in range(N):
    if A[i] != max_num[0]:
        print((max_num[0]))
    else:
        print((max_num[1]))
# Original solution
from collections import defaultdict

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

for a, b in zip(sorted(A), sorted(B)):
    if a > b:
        print('No')
        exit()

AI = [(a, i) for i, a in enumerate(A)]
BI = [(b, i) for i, b in enumerate(B)]
AI.sort()
BI.sort()

orderA = {}
orderB = {}

for k, ((_, i), (_, j)) in enumerate(zip(AI, BI)):
    orderA[i] = k
    orderB[j] = k

path = 0
visited = [False] * N
for i, a in enumerate(orderA):
    if visited[i]:
        continue
    visited[i] = True
    length = 0
    now = orderB[i]
    while now != a:
        now = orderA[now]
        visited[now] = True
        now = orderB[now]
        length += 1
    path = max(path, length)

if path <= N - 2:
    print('Yes')
else:
    print('No')

# Optimized solution
class UnionFind :
    def __init__(self, size) :
        self.parent = list(range(size))
        self.height = [0] * size
        self.size = [1] * size
        self.component = size

    def root(self, index) :
        if self.parent[index] == index :  # 根の場合
            return index
        rootIndex = self.root(self.parent[index])  # 葉の場合親の根を取得
        self.parent[index] = rootIndex  # 親の付け直し
        return rootIndex

    def union(self, index1, index2) :  # 結合
        root1 = self.root(index1)
        root2 = self.root(index2)

        if root1 == root2 :  # 連結されている場合
            return

        self.component -= 1  # 連結成分を減らす

        if self.height[root1] < self.height[root2] :
            self.parent[root1] = root2  # root2に結合
            self.size[root2] += self.size[root1]
        else :
            self.parent[root2] = root1  # root1に結合
            self.size[root1] += self.size[root2]
            if self.height[root1] == self.height[root2] :
                self.height[root1] += 1
        return

    def isSameRoot(self, index1, index2) :
        return self.root(index1) == self.root(index2)

    def sizeOfSameRoot(self, index) :
        return self.size[self.root(index)]

    def getComponent(self) :
        return self.component

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

for a, b in zip(sorted(A), sorted(B)):
    if a > b:
        print('No')
        exit()

# Bの昇順でAを並び替え
BA = list(zip(A, B))
BA.sort()

AI = [(a, i) for i, (_, a) in enumerate(BA)]
AI.sort()

tree = UnionFind(N)
for nessIndex, (_, originalIndex) in enumerate(AI):
    tree.union(nessIndex, originalIndex)

V = set()
for i in range(N):
    V.add(tree.root(i))

if len(V) > 1:  # サイクルが複数の場合
    print('Yes')
    exit()

if any(a <= b for a, b in zip(sorted(A)[1:], sorted(B)[:-1])):
    print('Yes')
    exit()

print('No')
# Original solution
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

# Optimized solution
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')

    elif total < 80:
        print('B')
        
    else:
        print('A')
# Original solution
while 1:
 m,f,r=list(map(int,input().split()));s=m+f
 if m==f==r<0:break
 if(m*f<0)|(s<30):print('F')
 elif(s<50)*(r<50):print('D')
 elif s<65:print('C')
 elif s<80:print('B')
 else:print('A')


# Optimized solution
while 1:
 m,f,r=list(map(int,input().split()));s=m+f
 if m==f==r<0:break
 if m*f<0 or s<30:print('F')
 elif(s<50)*(r<50):print('D')
 elif s<65:print('C')
 elif s<80:print('B')
 else:print('A')
# Original solution
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])


def calc_puddle(map, l, r):
    ans = 0
    top = map[l]
    before = map[l]
    for i in range(l + 1, r + 1):
        be_ans = ans
        if map[i] == before:
           ans += top - map[i]
        elif map[i] < before:
            ans += top - map[i] - 0.5
            before = map[i]
        else:
            ans += top - map[i] + 0.5
            before = map[i]
        #print(ans - be_ans)
    return int(ans)


cross_section = list(input())
map = [0]
y = 0
for c in cross_section:
    if c == "/":
        y += 1
        map.append(y)
    elif c == "\\":
        y += -1
        map.append(y)
    else:
        map.append(y)
max_right = len(map) - 1
#print(map)
#print(len(map))

left = 0
right = 1
ans = []
while left < max_right:
    #print(left, right)
    if map[left] <= map[right]:
        left = right
        right += 1
        if right == max_right:
            left = max_right
    elif right == max_right:
        break
    else:
        right += 1
        if map[left] == map[right]:
            ans.append(calc_puddle(map, left, right))
        elif right == max_right:
            left += 1
            right = left + 1
            if right == max_right:
                left = max_right

print(sum(ans))
ans.insert(0, len(ans))
print_list_split_whitespace(ans)


# Optimized solution
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls)
# Original solution
cal = {}
month = [[31,28,31,30,31,30,31,31,30,31,30,31],
         [31,29,31,30,31,30,31,31,30,31,30,31]]
count = 1
for y in range(3000):#
    f = 1 if y%4 == 0 and y%100 != 0 or y%400 == 0 else 0
    for m in range(12):
        for d in range(month[f][m]):
            cal[(y,m+1,d+1)] = count
            count += 1
while True:
    y1,m1,d1,y2,m2,d2 = list(map(int,input().split()))
    if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
        break
    print(cal[(y2,m2,d2)] - cal[(y1,m1,d1)])

# Optimized solution
from datetime import datetime
while True:
    y1,m1,d1,y2,m2,d2 = list(map(int,input().split()))
    if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
        break
    print((datetime(y2,m2,d2) - datetime(y1,m1,d1)).days)
# Original solution
from sys import stdin

N = int(stdin.readline())
A = [None]*N
B = [None]*N
for i in range(N):
    A[i], B[i] = list(map(int, stdin.readline().split()))

now = 0
for i in range(N):
    job = B.index(min(B))
    now += A[job]
    deadline = B[job]
    B[job] = 10000000000
    if now > deadline:
        print("No")
        quit()
else:
    print("Yes")

# Optimized solution
from sys import stdin

N = int(stdin.readline())
Job = [None]*N
for i in range(N):
    Job[i] = tuple(map(int, stdin.readline().split()))[::-1]

Job.sort()

Now = 0
for i in range(N):
    Deadline = Job[i][0]
    Now += Job[i][1]
    if Now > Deadline:
        print("No")
        quit()

else:
    print("Yes")