def insert_sort(a): for i in range(1, len(a)): key = a[i] j = i - 1 while j >= 0 and a[j] < key: a[j+1] = a[j] j-=1 a[j+1] = key return a def bubble_sort(a): flag = True while flag: flag = False for i in range(len(a)-1): if a[i] < a[i+1]: flag = True a[i], a[i+1] = a[i+1], a[i] return a def quick_sort(a, l, r): if l >= r: return a mid = a[r] first = l last = r while first < last: while first < last and a[first] >= mid: first+=1 a[last] = a[first] while first < last and a[last] <= mid: last-=1 a[first] = a[last] a[first] = mid quick_sort(a, l, first-1) quick_sort(a, first+1, r) return a def merge(a, b, k): j, i = 0, 0 c = [] if k == 1: while(i < len(a) and j < len(b)): if a[i] > b[j]: c.append(a[i]) i+=1 else: c.append(b[j]) j+=1 else: while(i < len(a) and j < len(b)): if a[i] < b[j]: c.append(a[i]) i+=1 else: c.append(b[j]) j+=1 c.extend(a[i:]) c.extend(b[j:]) return c def merge_sort(a, l, r, k): if r - l <= 1: return a[l:r] mid = (r + l) // 2 left = merge_sort(a, l, mid,k) right = merge_sort(a, mid, r,k) res = merge(left, right, k) return res def shell_sort(a, n): h = 1 while h < n / 3: h = int(h*3+1) while h >= 1: for i in range(h, n): j = i while j >= h and a[j] > a[j-h]: a[j], a[j-h] = a[j-h], a[j] j-=h h = int(h/3) return a def jio_sort(s): a = [] b = [] for i in s: if i % 2 == 0: a.append(i) else: b.append(i) k = merge_sort(a, 0, len(a), 0) k1 = shell_sort(b, len(b)) k1.extend(k) return k1 # while True: # try: s = list(map(int, input().split())) #print(s) res = jio_sort(s) res = map(str, res) p = ' '.join(res) print(p) #jio_sort(s) # except: # break