c0 = input().split()
c1 = input().split()
c2 = input().split()
c3 = input().split()

print(" ".join(c3[::-1]))
print(" ".join(c2[::-1]))
print(" ".join(c1[::-1]))
print(" ".join(c0[::-1]))

c0 = input().split()
c1 = input().split()
c2 = input().split()
c3 = input().split()

print(" ".join(c3[::-1]))
print(" ".join(c2[::-1]))
print(" ".join(c1[::-1]))
print(" ".join(c0[::-1]))
