Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

for v in arr:

    i = arr_sort.index(v)
    
    arr01 = arr_sort[:i] + arr_sort[i + 1:]
    
    print(arr01[val])

Fixed submission:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

val1 = arr_sort[(n // 2)-1]
val2 = arr_sort[(n // 2)]

for v in arr:
    
    if v<=val1:
        
        print(val2)
        
    else:
        
        print(val1)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))


for i in range(0, len(arr)):
    
    arr01=sorted(arr[:i]+arr[i+1:])
    
    print(arr01[val])
    

Fixed submission:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

val1 = arr_sort[(n // 2)-1]
val2 = arr_sort[(n // 2)]

for v in arr:
    
    if v<=val1:
        
        print(val2)
        
    else:
        
        print(val1)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
val=(n-1)//2

arr=list(map(int, arr_data[1]))

#print(arr)

cnt = 0
while cnt < n:
      
    arr_temp=arr.copy()  
    
    arr_temp.pop(cnt)
    
    arr02 = sorted(arr_temp)
    print(arr02[val])
    
    cnt += 1
    
    

Fixed submission:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

val1 = arr_sort[(n // 2)-1]
val2 = arr_sort[(n // 2)]

for v in arr:
    
    if v<=val1:
        
        print(val2)
        
    else:
        
        print(val1)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

cnt = 0

while cnt < n:


    arr=[]
    for i in range(0, n):
        
        if cnt != i:

            arr.append(int(arr_data[1][i]))

    
    print(sorted(arr)[(n//2)-1])        
    cnt += 1

Fixed submission:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

val1 = arr_sort[(n // 2)-1]
val2 = arr_sort[(n // 2)]

for v in arr:
    
    if v<=val1:
        
        print(val2)
        
    else:
        
        print(val1)