#!/usr/bin/env python3

# Declare n before our loop
n = 0

numbers = list()
strings = list()

# Choose whatever input you want to quit with
while n != 'q':
    n = input()
    # Try and parse our input as an int
    try:
        n = int(n)
        numbers.append(n)
    # If we hit an exception that means that n can not be parsed as an integer
    except ValueError:
        if n != 'q':
            strings.append(n)

numbers.sort()
strings.sort()

print(numbers)
print(strings)