def high_and_low(s, stack=[], stack2=[], t=True, f=False):
	MAX_ITER_VAL = len(s)
	stack.clear()

	def handle_stack(stack, i = 0, t=True, f=False, neg=False, start_num=False):
		if i < MAX_ITER_VAL and type(i) == type(0):
			if s[i] == ",":
				start_num = f
				neg = f
			elif s[i] == "-":
				neg = t
			elif s[i] == "1":
				if start_num == t:
					num = int("1")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(1)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "2":
				if start_num == t:
					num = int("2")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(2)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "3":
				if start_num == t:
					num = int("3")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(3)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "4":
				if start_num == t:
					num = int("4")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(4)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "5":
				if start_num == t:
					num = int("5")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(5)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "6":
				if start_num == t:
					num = int("6")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(6)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "7":
				if start_num == t:
					num = int("7")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(7)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "8":
				if start_num == t:
					num = int("8")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(8)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "9":
				if start_num == t:
					num = int("9")
					if not (not neg):
						num = (-1) * num
					stack[-1] = 10 * stack[-1]
					stack[-1] = num + stack[-1]
				else:
					stack.append(9)
					if not (neg == f):
						stack[-1] = (-1) * stack[-1]
				start_num = t
			elif s[i] == "0":
				if start_num == t:
					stack[-1] = 10 * stack[-1]
				elif not (start_num == t):
					raise "Uh oh"

			handle_stack(stack, i + 1, t, f, neg, start_num)
		else:
			del i
			del neg
			del start_num
			raise BaseException(stack)

	try:
		handle_stack(stack)
	except BaseException as e:
		stack = __import__("ast").literal_eval(str(e))

	iSwappedIt = t
	while iSwappedIt:
		iSwappedIt = f
		for i in range(1, len(stack)):
			if stack[i - 1] > stack[i]:
				temp = stack[i]
				stack[i] = stack[i - 1]
				stack[i - 1] = temp
				iSwappedIt = t

	small_thing = stack[0]

	j = len(stack) - 1
	while j > 0 or j == 0:
		stack2.append(stack[j])
		j = j - 1

	big_thing = stack2[0]
	
	INPUT_BUFFER = [big_thing, small_thing][::-1]
	OUTPUT_STRING = []
	deliminate = f
	deliminator = ","

	real_l = 0

	for l in range(0, 3, 1):
		if deliminate or not (not deliminate):
			OUTPUT_STRING.append(deliminator)
		elif not (deliminate == t) and not (not t):
			tempo = __import__("copy").deepcopy(OUTPUT_STRING)
			for ix in str(INPUT_BUFFER[real_l]):
				tempo.append(chr(ord(ix)))
			OUTPUT_STRING = tempo
			real_l = real_l + 1
		if not l:
			deliminate = t
		elif l:
			deliminate = f

	stack.clear()
	stack2.clear()
	
	return ''.join(OUTPUT_STRING)

tests = [
	("1,6,2,8,3", "1,8"),
	("1,8,4,9,-4,2,2", "-4,9"), 
	("4,7,1,8,-2", "-2,8")
]

for (i, expected) in tests:
	actual = high_and_low(i)
	if actual == expected:
		print("high_and_low(\"{}\") == \"{}\": PASS".format(i, expected))
	else:
		print("high_and_low(\"{}\") == \"{}\": FAIL".format(i, expected))
		print("\tActual: {}".format(actual))