def input_lines():
    k = 0
    numbers = []
    numberOfElements = int(input())
    while k < numberOfElements:
        numbers.append(input())
        k += 1
    return numbers

text = list(input_lines())

evens = []
odds = []
i = 0
while i < len(text):
    element = int(text[i])
    if (element % 2 == 0):
        evens.append(element)
    else:
        odds.append(element)
    i += 1
evens.sort()
odds.sort(reverse=True)
finalArray = []
finalArray = evens + odds
for el in finalArray:
    print(el) 

1ae35c0803250f5f699828be939706a43af73f2f
<mask token>

def input_lines():
    k = 0
    numbers = []
    numberOfElements = int(input())
    while k < numberOfElements:
        numbers.append(input())
        k += 1
    return numbers


<mask token>

def input_lines():
    k = 0
    numbers = []
    numberOfElements = int(input())
    while k < numberOfElements:
        numbers.append(input())
        k += 1
    return numbers


<mask token>
while i < len(text):
    element = int(text[i])
    if element % 2 == 0:
        evens.append(element)
    else:
        odds.append(element)
    i += 1
evens.sort()
odds.sort(reverse=True)
<mask token>
for el in finalArray:
    print(el)

def input_lines():
    k = 0
    numbers = []
    numberOfElements = int(input())
    while k < numberOfElements:
        numbers.append(input())
        k += 1
    return numbers


text = list(input_lines())
evens = []
odds = []
i = 0
while i < len(text):
    element = int(text[i])
    if element % 2 == 0:
        evens.append(element)
    else:
        odds.append(element)
    i += 1
evens.sort()
odds.sort(reverse=True)
finalArray = []
finalArray = evens + odds
for el in finalArray:
    print(el)

def input_lines():
    k = 0
    numbers = []
    numberOfElements = int(input())
    while k < numberOfElements:
        numbers.append(input())
        k += 1
    return numbers

text = list(input_lines())

evens = []
odds = []
i = 0
while i < len(text):
    element = int(text[i])
    if (element % 2 == 0):
        evens.append(element)
    else:
        odds.append(element)
    i += 1
evens.sort()
odds.sort(reverse=True)
finalArray = []
finalArray = evens + odds
for el in finalArray:
    print(el) 
