i,n=input(),'\n';exec"print n.join(i)+n;i=map(i.pop,[-1,0]*3);"*6
['house', 'grandmother', 'child', 'stove', 'almanac', 'tears']
house grandmother child stove almanac tears tears house almanac grandmother stove child child tears stove house grandmother almanac almanac child grandmother tears house stove stove almanac house child tears grandmother grandmother stove tears almanac child house