for t in [[1, 2, 3, 4], [5, 6, 7, 8]]: for i in range(len(t)): print(t[i], t[(i + 1) % len(t)])print(1, 9)