m@main=getLine>>=putStrLn.unlines.f.map read.words>>m f x=unwords(map show x):sum x`take`f(map abs$zipWith(-)x$tail x++x)