a=map(raw_input,['']*3) i=1;exec'a+=a.pop(0),\nfor x in a+[""]:print x[i%16:]+x[:i%16]\ni+=1;'*48