arr = input("Введите числа через запятую: ")
arr = arr.split(",")
m = list(range(2))
o = 0
for i in range(len(arr)):
arr[i] = int(arr[i])
for i in range(len(arr)):
if arr[i] < 0:
m[o] = arr[i]
o += 1
if m[0] < 0 and m[1] < 0:
break
print(str(m[0]) + " " + str(m[1]))