When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.
You are given N numbers X_1, X_2, ..., X_N, where N is an even number.
For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.
Find B_i for each i = 1, 2, ..., N.

-----Constraints-----
 - 2 \leq N \leq 200000
 - N is even.
 - 1 \leq X_i \leq 10^9
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
X_1 X_2 ... X_N

-----Output-----
Print N lines.
The i-th line should contain B_i.

-----Sample Input-----
4
2 4 4 3

-----Sample Output-----
4
3
3
4

 - Since the median of X_2, X_3, X_4 is 4, B_1 = 4.
 - Since the median of X_1, X_3, X_4 is 3, B_2 = 3.
 - Since the median of X_1, X_2, X_4 is 3, B_3 = 3.
 - Since the median of X_1, X_2, X_3 is 4, B_4 = 4.
[{"code": "n = int(input())\nx = list(map(int,input().split()))\n\ny = sorted(x)\n\nans1 = y[n//2]\nans2 = y[n//2-1]\n\nfor i in x :\n    if i < ans1 :\n        print(ans1)\n    else :\n        print(ans2)\n", "passed": true, "time": 0.23, "memory": 14320.0, "status": "done"}, {"code": "import bisect\nn=int(input())\nx=list(map(int,input().split()))\nm=n//2\ny=sorted(x)\nfor i in range(n):\n  if bisect.bisect_right(y,x[i])>m:\n    print(y[m-1])\n  else:\n    print(y[m])", "passed": true, "time": 0.48, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\n\nfor i in range(n):\n    x[i] = (x[i], i)\n\nx.sort()\n\nanswers = [x[n//2 - 1][0]] * n\n\nans = x[n//2][0]\nfor i in range(n//2):\n    answers[x[i][1]] = ans\n\nfor i in answers:\n    print(i)", "passed": true, "time": 0.2, "memory": 14216.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\ny=sorted(x)\nt,w=y[n//2-1],y[n//2]\nfor i in range(n):\n    if x[i]<w:\n        print(w)\n    else:\n        print(t)", "passed": true, "time": 0.15, "memory": 14156.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\ny = sorted(x)\n#m = y[n//2-1:n//2+1]\nm_index = n//2-1\nm = y[m_index]\n\nfor i in range(n):\n  if x[i] <= m:\n    print(y[m_index+1])\n  else:\n    print(y[m_index])", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "n=int(input())\na=[int(i) for i in input().split()]\n\nb=a[:]\na.sort()\n\none=a[n//2-1]\ntwo=a[n//2]\n\ndef get_median(i):\n    if b[i]<=one:\n        return two\n    return one\n\nfor i in range(n):\n\tprint(get_median(i))", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    x = [int(xn) for xn in input().split()]\n    x_sorted = sorted(x)\n    idx_median = n // 2\n    median_low = x_sorted[idx_median - 1]\n    median_high = x_sorted[idx_median]\n    for xn in x:\n        print((median_high if xn <= median_low else median_low))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14368.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\ny=sorted(x)\nk,l=y[n//2-1],y[n//2]\nfor i in range(n):\n    if x[i]<=k:\n        print(l)\n    else:\n        print(k)", "passed": true, "time": 0.33, "memory": 14200.0, "status": "done"}, {"code": "N = int(input())\nXS = [int(i) for i in input().split()]\n\nsxs = sorted(XS)\na1 = sxs[N//2-1]\na2 = sxs[N//2]\n\nfor i in range(N):\n  x = XS[i]\n  if x <= a1:\n    print(a2)\n  else:\n    print(a1)\n", "passed": true, "time": 0.15, "memory": 14340.0, "status": "done"}, {"code": "N = int(input())\nN_List = list(map(int,input().split()))\nN_List_Sorted = sorted(N_List)\nB = N_List_Sorted[N//2]\nA = N_List_Sorted[N//2 - 1]\n\nif A == B:\n    for i in range(N):\n        print(A)\nelse:\n    for i in range(N):\n        if N_List[i] <= A:\n            print(B)\n        else:\n            print(A)\n\n\n\n", "passed": true, "time": 0.36, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\nlis = sorted(x)\nkey1 = lis[n//2-1]\nkey2 = lis[n//2]\nfor i in x:\n    if i > key1:\n        print(key1)\n    else:\n        print(key2)\n", "passed": true, "time": 0.22, "memory": 14104.0, "status": "done"}, {"code": "import statistics\n\nn = int(input())\nx = list(map(int, input().split()))\nxmd = statistics.median(x)\nxs = sorted(x)\nfor i in x:\n    if i < xmd:\n        print((xs[n // 2]))\n    else:\n        print((xs[n // 2 - 1]))\n", "passed": true, "time": 0.16, "memory": 14332.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nAA = sorted(A)\nX = AA[N//2 - 1]\nY = AA[N//2]\nfor i in range(N):\n  if A[i] < Y:\n    print(Y)\n  if A[i] >= Y:\n    print(X)", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "import copy\n\nN = int(input())\nX = list(map(int, input().split()))\n\nx = copy.deepcopy(X)\nx.sort()\n\nx1 = x[N // 2 - 1]\nx2 = x[N // 2]\n\nfor xx in X:\n    if xx <= x1:\n        print(x2)\n    else:\n        print(x1)", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "#51 C - Many Medians\nN = int(input())\nX = list(map(int,input().split()))\nXsrt = sorted(X,reverse = False)\nXL = set(Xsrt[:N//2])\nXR = set(Xsrt[N//2:])\n\nans = []\nfor x in X:\n    if x in XR:\n        ans.append(Xsrt[N//2-1])\n    elif x in XL:\n        ans.append(Xsrt[N//2])\nfor a in  ans:\n    print(a)", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\n\ndef main():\n    import statistics\n    n = i_input()\n    l = i_list()\n    ml = min(l)\n    Ml = max(l)\n    ol = statistics.median(l)\n\n    L = l.copy()\n\n    L.remove(ml)\n    pol = statistics.median(L)\n    L.append(ml)\n\n    L.remove(Ml)\n    mol = statistics.median(L)\n    L.append(Ml)\n\n    ans = []\n\n    for i in l:\n        if i >= ol:\n            ans.append(mol)\n        else:\n            ans.append(pol)\n\n    for i in ans:\n        print(i)\n\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.25, "memory": 14776.0, "status": "done"}, {"code": "N = int(input())\nX_list = list(map(int, input().split()))\ntmp = X_list.copy()\n\ntmp.sort()\na = tmp[int(N/2)-1]\nb = tmp[int(N/2)]\nfor i in range(N):\n    if(X_list[i] <= a):\n        print(b)\n    else:\n        print(a)", "passed": true, "time": 0.22, "memory": 14116.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\nx = sorted(X)\nms = x[N//2-1]\nfor i in range(N):\n    if X[i] > ms:\n        print(ms)\n    else:\n        print(x[N//2])", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "n = int(input())\nX = list(map(int, input().split()))\n\nx = list(enumerate(X))\n\nx.sort(key=lambda x: x[1])\nA = list([x[1] for x in x[n//2-1:n//2+1]])\n\nfor v in X:\n    if v <= A[0]:\n        print((A[1]))\n    else:\n        print((A[0]))\n", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Sep 22 14:57:09 2020\n\n@author: liang\n\"\"\"\n\nN = int(input())\nX = [int(x) for x in input().split()]\nY = X.copy()\nY.sort()\nupper = Y[N//2]\nlower = Y[N//2-1]\n\nfor i in range(N):\n    if X[i] < upper:\n        print(upper)\n    else:\n        print(lower)", "passed": true, "time": 0.15, "memory": 14292.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\ny = sorted(x)\na = y[n // 2 - 1]\nb = y[n // 2]\nfor i in x:\n    print((a, b)[i <= a])", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n = int(input())\nX = list(map(int, input().split()))\nx = sorted(X)\n\nres1 = x[n//2]\nres2 = x[n//2 -1]\n\nfor i in range(n):\n  if X[i] >= res1:\n    print(res2)\n  elif X[i] <= res2:\n    print(res1)", "passed": true, "time": 0.16, "memory": 14140.0, "status": "done"}, {"code": "N=int(input())\n*X,=map(int,input().split())\ns=sorted(X)\n\nt1=s[N//2-1]\nt2=s[N//2]\n\nfor x in X:\n    if x<=t1:\n        print(t2)\n    else:\n        print(t1)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\nst=sorted(x)\na=st[len(st)//2-1]\nb=st[len(st)//2]\n\nfor i in x:\n  if i<=a:\n    print(b)\n  else:\n    print(a)\n", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int, input().split()))\nXs = sorted(X)\nc = int(N/2)\na, b = Xs[c-1], Xs[c]\nfor i in range(N):\n\tif X[i] <= a:\n\t\tprint(b)\n\telse:\n\t\tprint(a)", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "n = int(input())\nX = list(map(int, input().split()))\ns = sorted(X)\n\nmed_low = s[n//2 - 1]\nmed_high = s[n//2]\n\nfor x in X:\n    if x <= med_low: print(med_high)\n    else: print(med_low)", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}, {"code": "N = int(input())\nX = [int(i) for i in input().split()]\nXs = list(sorted(X))\nfor x in X:\n    if x > Xs[N // 2 - 1]:\n        print((Xs[N // 2 - 1]))\n    else:\n        print((Xs[N // 2]))\n", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\nw = tuple(x)\nx.sort()\nif x[(n//2)-1] == x[n//2]:\n    for i in range(n):\n        print(x[n//2])\nelse:\n    for h in w:\n        if h <= x[(n//2)-1]:\n            print(x[n//2])\n        else:\n            print(x[(n//2)-1])", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "N = int(input())\nXls = list(map(int,input().split()))\nX2ls = sorted(Xls)\nM1 = X2ls[N//2-1]\nM2 = X2ls[N//2]\nlsans = []\nfor i in range(N):\n    if Xls[i] <= M1:\n        M = M2\n    else:\n        M = M1\n    lsans.append(M)\nfor i in lsans:\n    print(i)", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "#!/usr/bin/env python\nimport sys \nimport copy\ninput = sys.stdin.readline\n\nn = int(input())\nx = list(map(int, input().split()))\nxx = sorted(x)\n\nl = xx[(n-1)//2]\nr = xx[n//2]\nmid = (l+r)/2\n\nfor i in range(n):\n    if x[i] >= mid:\n        print(l)\n    else:\n        print(r)\n", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "a = int(input())\nb = list(map(int,input().split()))\n\nc = sorted(b, reverse=True)\n\nm = int(a / 2) - 1\nanslist = [0] * a\nfor i, data in enumerate(b):\n    if c[m] > data:\n        anslist[i] = c[m]\n    elif c[m] <= data:\n        anslist[i] = c[m + 1]\n        \nfor j in range(a):\n    print(anslist[j])", "passed": true, "time": 0.26, "memory": 14292.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\nx_sort = sorted(x)\nhalf_l = x_sort[(n-1)//2]\nhalf_r = x_sort[(n)//2]\n\nfor i in range(n):\n    if x[i] <= half_l:\n        print(half_r)\n    else:\n        print(half_l)\n", "passed": true, "time": 0.15, "memory": 14188.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\nxs = sorted(x)\nm = (xs[n//2]+xs[n//2-1])/2\nfor i in range(n):\n    if x[i]<=m:\n        print(xs[n//2])\n    else:\n        print(xs[n//2-1])", "passed": true, "time": 0.15, "memory": 14184.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int, input().split()))\nX_sorted = sorted(X)\npre_med_index = (N // 2) - 1\npos_med_index = N // 2\nimport bisect\n\nfor i in range(N):\n    if X[i] <= X_sorted[pre_med_index]:\n        print((X_sorted[pos_med_index]))\n    else:\n        print((X_sorted[pre_med_index]))\n", "passed": true, "time": 0.47, "memory": 14144.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    n = ini()\n    x = inl()\n    y = sorted(x)\n\n    p = y[n // 2 - 1]\n    q = y[n // 2]\n\n    for i in range(n):\n        if x[i] < q:\n            print(q)\n        else:\n            print(p)\n\n\nsolve()\n", "passed": true, "time": 0.15, "memory": 14240.0, "status": "done"}, {"code": "N=int(input())\nX=list(map(int,input().split()))\nA=sorted(X)\nfor i in range(N):\n    if X[i]<=A[N//2-1]:\n        print(A[N//2])\n    else:\n        print(A[N//2-1])", "passed": true, "time": 0.47, "memory": 14088.0, "status": "done"}, {"code": "from decimal import Decimal\n\nn = int(input())\nx = list(map(int, input().split()))\n\ny = x.copy()\n\ny.sort()\n\nm1 = y[n//2]\nm2 = y[n//2 - 1]\nm = Decimal(m1 + m2) / Decimal(2) \n#print(m1, m2)\n\nfor z in x:\n    if z <= m:\n        print(m1)\n    else:\n        print(m2)", "passed": true, "time": 0.27, "memory": 14088.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\nY = sorted(X)\nA = Y[N//2]\nB = Y[N//2-1]\nfor i in range(N):\n  if X[i] <= B:\n    print(A)\n  else:\n    print(B)", "passed": true, "time": 0.15, "memory": 14052.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\n\nx_sort = sorted(x)\nlenth = len(x)\nlow = x_sort[int(lenth/2)-1]\nhigh = x_sort[int(lenth/2)]\n\nfor y in x:\n    if y <= low:\n        print(high)\n    else:\n        print(low)", "passed": true, "time": 0.16, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\ny = x.copy()\ny.sort()\nz = set(x)\nt1 = y[n//2-1]\nt2 = y[n//2]\nidx = dict([])\nidx[y[0]] = 0\nl = y[0]\ncnt = 0\nfor i in y:\n    if i == l:\n        cnt += 1\n        continue\n    else:\n        idx[i] = cnt\n        l = i\n        cnt += 1\n\nfor i in x:\n    t = idx[i]\n    if t<n//2:\n        print(t2)\n    else:\n        print(t1)", "passed": true, "time": 0.21, "memory": 14144.0, "status": "done"}, {"code": "n=int(input())\nxlist=list(map(int,input().split()))\n\ntmpx=sorted(xlist)\nmed1,med2 = tmpx[n//2-1],tmpx[n//2]\n# print(x)\n# print(med1,med2)\n\nfor x in xlist:\n    if x<=med1:\n        print(med2)\n    else:\n        print(med1)\n\n", "passed": true, "time": 0.23, "memory": 14212.0, "status": "done"}, {"code": "import statistics\nn=int(input())\nx=list(map(int,input().split()))\ny=statistics.median(x)\nxs=sorted(x)\nfor i in x:\n    if i<y:\n        print((xs[n//2]))\n    else:\n        print((xs[n//2-1]))\n        \n", "passed": true, "time": 0.16, "memory": 14140.0, "status": "done"}, {"code": "N=int(input())\n*X,=map(int,input().split())\ns=sorted(X)\n \nt1=s[N//2-1]\nt2=s[N//2]\n \nfor x in X:\n    if x<=t1:\n        print(t2)\n    else:\n        print(t1)", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "import copy\nn = int(input())\na = [int(x) for x in input().split()]\nb = copy.copy(a)\nb.sort()\nm = (b[n//2] + b[n//2 - 1]) // 2\nfor i in range(n):\n  if m < a[i]:\n    print((b[n//2 - 1]))\n  else:\n    print((b[n//2]))\n", "passed": true, "time": 0.14, "memory": 14224.0, "status": "done"}, {"code": "N=int(input())\nX=list(map(int,input().split()))\nimport copy\nY=copy.copy(X)\nY.sort()\n\nif Y[N//2]==Y[N//2-1]:\n    for i in range(N):\n        print((Y[N//2]))\nelse:\n    for i in range(N):\n        if X[i]<=Y[N//2-1]:\n            print((Y[N//2]))\n        else:\n            print((Y[N//2-1]))\n", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int, input().split()))\norg = X.copy()\n\nX.sort()\n\nright = int(N // 2)\nleft = right - 1\n\nmed = (X[left] + X[right]) / 2\n\nfor x in org:\n    if x >= med:\n        print((X[left]))\n    else:\n        print((X[right]))\n", "passed": true, "time": 0.23, "memory": 14120.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\nans=sorted(x)\nans2=ans[n//2-1]\nans1=ans[n//2]\n\nfor i in range(n):\n  if x[i]>=ans[n//2]:\n    print(ans2)\n  else:\n    print(ans1)\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int, input().split()))\nmed1 = sorted(X)[N // 2 - 1]\nmed2 = sorted(X)[N // 2]\nfor i in range(N):\n    tmp = X[i]\n    if tmp <= med1:\n        print(med2)\n    else:\n        print(med1)\n", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\ns = list(sorted(a))\nind = {}\nfor i in range(N):\n    if s[i] not in ind:\n        ind[s[i]] = i\nfor i in range(N):\n    if ind[a[i]] < N//2:\n        print(s[N//2])\n    else:\n        print(s[N//2-1])", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\nx_2 = sorted(x)\nm_1 = x_2[n//2-1]\nm_2 = x_2[n//2]\nfor i in range(n):\n    if x[i] <= m_1:\n        print(m_2)\n    elif x[i] >= m_2:\n        print(m_1)\n\n", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\nl = sorted(x)\nans_1 = l[n//2 - 1]\nans_2 = l[n//2]\nfor i in x:\n  if i <= ans_1:\n    print(ans_2)\n  else:\n    print(ans_1)\n", "passed": true, "time": 0.15, "memory": 14356.0, "status": "done"}, {"code": "import bisect\n\nn = int(input())\nX = list(map(int, input().split()))\n\nsorted_x = sorted(X)\n\nl, r = sorted_x[n//2], sorted_x[n//2-1]\n\nfor x in X:\n    if bisect.bisect_left(sorted_x, x) < n // 2:\n        print(l)\n    else:\n        print(r)", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "def getval():\n    n = int(input())\n    x = list(map(int,input().split()))\n    return n,x \n\ndef main(n,x):\n    y = sorted(x)\n    a,b = y[(n-1)//2],y[(n-1)//2+1]\n    for i in x:\n        if i>a:\n            print(a)\n        else:\n            print(b)\n\ndef __starting_point():\n    n,x = getval()\n    main(n,x)\n__starting_point()", "passed": true, "time": 0.15, "memory": 14336.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\nY = sorted(X)\n\nm1=Y[N//2-1]\nm2=Y[N//2]\n\nmedians = [m2 if x < m2 else m1 for x in X]\nprint('\\n'.join(map(str,medians)))", "passed": true, "time": 0.24, "memory": 14236.0, "status": "done"}, {"code": "import math\nimport statistics\n\nn = int(input())\nxL = list(map(int, input().split(\" \")))\n\nxL2 = []\nfor i in range(n):\n    xL2.append([i, xL[i]])\nxL2 = sorted(xL2, key=lambda x: x[1])\n\nif n % 2 == 0:\n    center = n // 2\n    centers = [xL2[center - 1], xL2[center]]\n    for i in range(n):\n        if i == centers[0][0] or i == centers[1][0]:\n            print(statistics.median(xL[:i] + xL[i + 1:]))\n        else:\n            if centers[0][1] < xL[i]:\n                print(centers[0][1])\n            else:\n                print(centers[1][1])\nelse:\n    center = n // 2\n    centers = [xL2[center - 1], xL2[center], xL2[center + 1]]\n    for i in range(n):\n        if i == centers[0][0] or i == centers[1][0] or i == centers[2][0]:\n            print(statistics.median(xL[:i] + xL[i + 1:]))\n        else:\n            if centers[0][1] < xL[i]:\n                print((centers[0][1] + centers[1][1]) / 2)\n            else:\n                print((centers[1][1] + centers[2][1]) / 2)", "passed": true, "time": 0.26, "memory": 14176.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\nx2 = sorted(x)\nmid = n//2-1\nfor i in range(n):\n    xi = x[i]\n    if x2[mid] < xi:\n        print((x2[mid]))\n    else:\n        print((x2[mid+1]))\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    x_lst = list(map(int, input().split()))\n    x_sorted_lst = sorted(x_lst)\n\n    median1 = x_sorted_lst[n // 2 - 1]\n    median2 = x_sorted_lst[n // 2]\n\n    if median1 == median2:\n        lst = [median1] * n\n\n    else:\n        lst = []\n        for i in range(n):\n            x = x_lst[i]\n\n            if x <= median1:\n                lst.append(median2)\n            elif median2 <= x:\n                lst.append(median1)\n\n    for i in range(n):\n        print(lst[i])\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\n\nnums = sorted(x)\nm1 = n//2-1\nm2 = n//2\nfor i in range(n):\n  if x[i] <= nums[m1]: print(nums[m2])\n  elif nums[m2] <= x[i]: print(nums[m1])", "passed": true, "time": 0.21, "memory": 14096.0, "status": "done"}, {"code": "import copy\n\ndef main():\n\tN = int(input())\n\tX = [int(x) for x in input().split(\" \")]\n\tsortedX = copy.deepcopy(X)\n\tsortedX.sort()\n\tcand = [sortedX[int(N / 2) - 1], sortedX[int(N / 2)]]\n\n\tfor xi in X:\n\t\tif xi <= cand[0]:\n\t\t\tprint((cand[1]))\n\t\telse:\n\t\t\tprint((cand[0]))\n\nmain()\n", "passed": true, "time": 0.34, "memory": 14296.0, "status": "done"}, {"code": "N = int(input())\nx = list(map(int, input().split()))\na = sorted(x)\np = int(N/2)-1\nl = a[p]\nfor i in range(N):\n  n = p\n  if x[i] <= l:\n    n = p+1\n  print(a[n])", "passed": true, "time": 0.15, "memory": 14320.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\nY = sorted(X)\nmed = (Y[N//2] + Y[N//2-1])/2\nfor i in range(N):\n    if X[i] <= med:\n        print(Y[N//2])\n    else:\n        print(Y[N//2-1])", "passed": true, "time": 0.3, "memory": 14052.0, "status": "done"}, {"code": "import copy\nn = int(input())\nx = list(map(int,input().split()))\na = copy.deepcopy(x)\nx.sort()\nfor i in range(n):\n    if x[int(n/2)-1]<a[i]:\n        print((x[int(n/2)-1]))\n    else:\n        print((x[int(n/2)]))\n", "passed": true, "time": 0.17, "memory": 14204.0, "status": "done"}, {"code": "def main():\n    N = int(input())\n    X = list(map(int, input().split()))\n    Y = X.copy()\n    Y.sort()\n\n    if N%2 == 0:\n        mid1 = Y[N//2]\n        mid2 = Y[N//2-1]\n        for x in X:\n            if x <= mid2:\n                print(mid1)\n            else:\n                print(mid2)\n        return\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.23, "memory": 14124.0, "status": "done"}, {"code": "# import itertools\n# import math\n# from functools import reduce\n# import sys\n# sys.setrecursionlimit(500*500)\n# import numpy as np\n# import heapq\n# from collections import deque\nimport copy\n\nN = int(input())\n# S = input()\n# n, *a = map(int, open(0))\n# N, M = map(int, input().split())\nX = list(map(int, input().split()))\n# B = list(map(int, input().split()))\n# tree = [[] for _ in range(N + 1)]\n# B_C = [list(map(int,input().split())) for _ in range(M)]\n# S = input()\n\n# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])\n# all_cases = list(itertools.permutations(P))\n# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))\n# itertools.product((0,1), repeat=n)\n\n# A = np.array(A)\n# cum_A = np.cumsum(A)\n# cum_A = np.insert(cum_A, 0, 0)\n\n# def dfs(tree, s):\n#     for l in tree[s]:\n#         if depth[l[0]] == -1:\n#             depth[l[0]] = depth[s] + l[1]\n#             dfs(tree, l[0])\n# dfs(tree, 1)\n\n# def factorization(n):\n#     arr = []\n#     temp = n\n#     for i in range(2, int(-(-n**0.5//1))+1):\n#         if temp%i==0:\n#             cnt=0\n#             while temp%i==0:\n#                 cnt+=1\n#                 temp //= i\n#             arr.append([i, cnt])\n#     if temp!=1:\n#         arr.append([temp, 1])\n#     if arr==[]:\n#         arr.append([n, 1])\n#     return arr\n\n#def make_divisors(n):\n#    lower_divisors , upper_divisors = [], []\n#    i = 1\n#    while i*i <= n:\n#        if n % i == 0:\n#            lower_divisors.append(i)\n#            if i != n // i:\n#                upper_divisors.append(n//i)\n#        i += 1\n#    return lower_divisors + upper_divisors[::-1]\n\n# def gcd_list(numbers):\n#     return reduce(math.gcd, numbers)\n\n# if gcd_list(A) > 1:\n#     print(\"not coprime\")\n#     return\n\n# \u9ad8\u901f\u7d20\u56e0\u6570\u5206\u89e3\u6e96\u5099\n#MAXN = 10**6+10\n#sieve = [i for i in range(MAXN+1)]\n#p = 2\n#while p*p <= MAXN:\n#    if sieve[p] == p:\n#        for q in range(2*p, MAXN+1, p):\n#            if sieve[q] == q:\n#                sieve[q] = p\n#    p += 1\n\nX = [[i, x] for i, x in enumerate(X)]\nX = sorted(X, reverse=False, key=lambda x:x[1])\nX_ranked = copy.copy(X)\nX = [[l[0], i, l[1]] for i, l in enumerate(X)]\nX = sorted(X, reverse=False, key=lambda x:x[0])\n\nmed = len(X) // 2\n\nfor l in X:\n    if l[1] < med:\n        print((X_ranked[med][1]))\n    else:\n        print((X_ranked[med - 1][1]))\n", "passed": true, "time": 0.15, "memory": 14132.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\ny = sorted(x)\n\nm = n // 2\np = y[m - 1]\nq = y[m]\nfor i in range(n):\n    if p < x[i]:\n        print(p)\n    else:\n        print(q)", "passed": true, "time": 0.21, "memory": 14280.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\nsort_X = sorted(X)\n\nmid_ls = [sort_X[N//2-1],sort_X[N//2]]\n\nfor i in range(N):\n  if X[i] >= mid_ls[1]:\n    print(mid_ls[0])\n  else:\n    print(mid_ls[1])", "passed": true, "time": 0.15, "memory": 14088.0, "status": "done"}, {"code": "import copy\nN = int(input())\nX = list(map(int, input().split()))\nXsort = copy.copy(X)\nXsort.sort()\ncenterR = Xsort[N//2]\ncenterL = Xsort[N//2-1]\nfor i in range(N):\n    if X[i] >= centerR:\n        print(centerL)\n    else:\n        print(centerR)\n", "passed": true, "time": 0.23, "memory": 14184.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\nx2 = sorted(x)\n\na = x2[n//2 - 1]\nb = x2[n//2]\n\nfor i in range(n):\n    if x[i] <= a:\n        print(b)\n    else:\n        print(a)", "passed": true, "time": 0.15, "memory": 14292.0, "status": "done"}, {"code": "N=int(input())\nX=list(map(int,input().strip().split()))\n\nY=sorted(X)\na=Y[N//2-1]\nb=Y[N//2]\nfor n in range(N):\n    if X[n]<=a:\n        print(b)\n    else:\n        print(a)", "passed": true, "time": 0.15, "memory": 14052.0, "status": "done"}, {"code": "N=int(input())\nX=list(map(int,input().split()))\nA=sorted(X)\nfor i in range(N):\n    if X[i]<=A[N//2-1]:\n        print((A[N//2]))\n    else:\n        print((A[N//2-1]))\n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\ny=sorted(x)\nk,l=y[n//2-1],y[n//2]\nfor i in range(n):\n    if x[i]<=k:\n        print(l)\n    else:\n        print(k)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "N = int(input())\nList = list(map(int,input().split()))\nA = sorted(List)\n\np,q=A[N//2-1:N//2+1]\n\nfor i in List:\n  print(p if i>=q else q)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "import copy\nN = int(input())\nX = list(map(int, input().split()))\ntmp_X = copy.deepcopy(X)\ntmp_X.sort()\nm1 = tmp_X[N // 2]\nm2 = tmp_X[N // 2 - 1]\nfor x in X:\n    if x < m1:\n        print(m1)\n    else:\n        print(m2)", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return list(map(int,input().split()))\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float(\"inf\")\n\nn = k()\nx = l()\np=sorted(x)\nmid = len(p)//2\nfor i in x:\n    a = bisect.bisect(p,i)\n    if a <= mid:\n        print((p[mid]))\n    else:\n        print((p[mid-1]))\n", "passed": true, "time": 0.14, "memory": 14388.0, "status": "done"}, {"code": "'''\nCreated on 2020/08/29\n\n@author: harurun\n'''\ndef main():\n  import copy\n  import sys\n  pin=sys.stdin.readline\n  pout=sys.stdout.write\n  perr=sys.stderr.write\n  \n  N=int(pin())\n  X=list(map(int,pin().split()))\n  t=(N+1)//2\n  Y=sorted(X)\n  ans1=Y[t-1]\n  ans2=Y[t]\n  median=ans1+ans2\n  for i in range(N):\n    s=X[i]\n    if s==ans1:\n      print(ans2)\n    elif s==ans2:\n      print(ans1)\n    elif  2*s<median:\n      print(ans2)\n    elif 2*s>median:\n      print(ans1)\n  return \n\nmain()", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n = int(input())\nX = list(map(int, input().split()))\n\nsorted_x = sorted(X)\n\nl, r = sorted_x[n//2-1], sorted_x[n//2]\n\nfor x in X:\n    if x < r:\n        print(r)\n    else:\n        print(l)", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\n\ny = sorted(x)\na = y[len(x)//2]\nb = y[(len(x)//2) - 1]\n\nfor i in range(n):\n    if x[i] <= b:\n        print(a)\n    else:\n        print(b)\n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "import statistics\nn = int(input())\nX = list(map(int, input().split()))\nX_ = sorted(X)\nmed = X_[n//2-1]\nmed_2 = X_[n//2]\nfor i in range(n):\n    if X[i]>med:\n        print(med)\n    else:\n        print(med_2)", "passed": true, "time": 0.15, "memory": 14172.0, "status": "done"}, {"code": "n = int(input())\nxn = list(map(int, input().split()))\nxn_s = sorted(xn)\nm1 = xn_s[n//2 - 1]\nm2 = xn_s[n//2]\nfor x in xn:\n    if x <= m1:\n        print(m2)\n    else:\n        print(m1)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\ny = sorted(x)\na = y[n // 2 - 1]\nb = y[n // 2]\nfor i in x:\n    print((a, b)[i <= a])", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "N = int(input())\nX = list(map(int,input().split()))\na = sorted(X)[N//2-1]\nb = sorted(X)[N//2]\n\nif a == b:\n  for _ in range(N):\n    print(a)\nelse:\n  for i in range(N):\n    if X[i] <= a:\n      print(b)\n    else:\n      print(a)", "passed": true, "time": 0.22, "memory": 14256.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\ndef main():\n    n = int(input())\n    x = list(map(int, input().split()))\n    ans = [0] * n\n    x_sort = sorted(x)\n    a = x_sort[1:n]\n    a_med = a[n // 2 - 1]\n    b = x_sort[0:n - 1]\n    b_med = b[n // 2 - 1]\n    for i in range(n):\n        if x[i] < a_med:\n            ans[i] = a_med\n        else:\n            ans[i] = b_med\n\n    print(*ans, sep='\\n')\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.22, "memory": 14076.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\nfor i in range(n):\n  x[i] = [x[i], i]\nx.sort(key=lambda x:x[0])\nfor i in range(n):\n  if i < n//2:\n    x[i] += [x[n//2][0]]\n  else:\n    x[i] += [x[n//2-1][0]]\n# x[i] = [value, init_index, b_i]\nx.sort(key=lambda x:x[1])\nfor i in range(n):\n  print(x[i][2])", "passed": true, "time": 0.23, "memory": 14132.0, "status": "done"}, {"code": "n = int(input())\nxx = list(map(int, input().split()))\nyy = sorted(xx)\n\na = yy[n//2-1]\nb = yy[n//2]\n\nfor x in xx:\n  if x <= a:\n    print(b)\n  elif x >= b:\n    print(a)", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "n = int(input())\n\nx = list(map(int, input().split()))\nx_sorted = sorted(x)\nmed_low = x_sorted[(n // 2) - 1]\nmed_upper = x_sorted[(n // 2)]\n\nfor i in range(n):\n    if x[i] <= med_low:\n        print(med_upper)\n    else:\n        print(med_low)\n", "passed": true, "time": 0.15, "memory": 14184.0, "status": "done"}, {"code": "import sys\nimport math\n\n\ninint = lambda: int(sys.stdin.readline())\ninintm = lambda: list(map(int, sys.stdin.readline().split()))\ninintl = lambda: list(inintm())\ninstrm = lambda: list(map(str, sys.stdin.readline().split()))\ninstrl = lambda: list(instrm())\n\n\nn = inint()\nX = inintl()\n\nX_sorted = sorted(X)\n\na, b = X_sorted[n//2-1],X_sorted[n//2]\n\nfor x in X:\n    if x <= a:\n        print(b)\n    else:\n        print(a)\n", "passed": true, "time": 0.15, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\nlst = list(map(int, input().split()))\n\nsorted_lst = sorted(lst)\nmini = sorted_lst[(n//2)-1]\nmaxi = sorted_lst[(n//2)]\nfor i in lst:\n    if i <= mini:\n        print(maxi)\n    else:\n        print(mini)", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "n = int(input())\nl = list(map(int,input().split()))\nsorted_list = sorted(l)\nleft = sorted_list[n//2-1]\nright = sorted_list[n//2]\nfor i in l:\n    if i <= left:\n        print(right)\n    else:\n        print(left)", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int,input().split()))\ny = sorted(x)\nindex = n//2\n\nfor i in range(n):\n  print(y[-index] if x[i]<y[index] else y[-index-1])", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "import sys\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return list(map(int, stdin.readline().split()))\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef main():\n    n = ni()\n    X = nl()\n    X_s = sorted(X)\n    mid = X_s[n // 2]\n    del_mid = (X_s[:n // 2] + X_s[n // 2 + 1:])[(n - 1) // 2]\n    for x in X:\n        if x < mid:\n            print(mid)\n        elif x > mid:\n            print((X_s[n // 2 - 1]))\n        else:\n            print(del_mid)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "n = int(input())\nX = list(map(int, input().split()))\nx = sorted(X)\nl = x[n//2-1]\nr = x[n//2]\nfor i in range(n):\n    if X[i] <= l:\n        print(r)\n    else:\n        print(l)\n", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}]