Indian National Olympiad in Informatics 2012
You are given a table with 2 rows and N columns. Each cell has an integer in it. The score of such a table is defined as follows: for each column, consider the sum of the two numbers in the column; the maximum of the N numbers so obtained is the score. For example, for the table
7162
1234

the score is max(7 + 1, 1 + 2, 6 + 3, 2 + 4) = 9.

The first row of the table is fixed, and given as input. N possible ways to fill the second row are considered:
1,2,...,N
2,3,...,N,1
3,4,...,N,1,2
···
N, 1, ... , ,N − 1

For instance, for the example above, we would consider each of the following as possibilities for the second row.
1234
2341
3412
4123

Your task is to find the score for each of the above choices of the second row. In the example above, you would evaluate the following four tables,
7162 7162 7162 7162
1234 2341 3412 4123

and compute scores 9, 10, 10 and 11, respectively.

-----Input format -----
The first line of the input has a single integer, N. The second line of the input has N integers, representing the first row, from left to right.

-----Output format -----
The output should consist of a single line with N integers. For 1 ² k ² N, the kth number in the output should be the score when the second row of the table is taken to be k,k+1,...,N,1,...,k−1.

-----Test Data -----
The testdata is grouped into two subtasks with the following constraints on the inputs.
• Subtask 1 [30 points] : 1 ≤ N ≤ 3000.
• Subtask 2 [70 points] : 1 ≤ N ≤ 200000.
In both the subtasks, all the integers in the first row of the table are between 1 and 100000, inclusive.

-----Example -----
Here is the sample input and output corresponding to the example above.

-----Sample input -----
4
7 1 6 2

-----Sample output-----
9 10 10 11

Note: Your program should not print anything other than what is specified in the output format. Please remove all diagnostic print statements before making your final submission. A program with extraneous output will be treated as incorrect!

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\ntry:\n    n=int(input())\n    \n    list_n = list(range(1,n+1))\n    list_n_flag=[]\n    \n    fix_arr = list(map(int,input().split()))\n    \n    \n    k=1\n    res_list=[]\n    fin_list=[]\n    list_n_flag = list_n[k:] + list_n[:k]\n    res_list = [list_n[i] + fix_arr[i] for i in range(len(fix_arr))]\n    maxx = max(res_list)\n    fin_list.append(maxx)\n    while list_n!=list_n_flag:\n        \n        res_list = [list_n_flag[i] + fix_arr[i] for i in range(len(fix_arr))]\n        maxx = max(res_list)\n        fin_list.append(maxx)\n        list_n_flag = list_n_flag[k:] + list_n_flag[:k]\n        \n    print(*fin_list,sep=" ")\nexcept:\n    pass'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13345