1 2 3 4 5 6
import fileinput for line in fileinput . input (): words = line . strip () . split () words . reverse () print (" " . join (words))