import sys

str = 'Tom Allen Jane William Tony'
list = str.split(" ")
print(list[0:2],list[1:4],list[3:5],sep='\n')
#easy way