n = 4
xs = list(range(1, n))
rot = lambda arr: arr[1:] + [arr[0]]
dct = {i: [0, 0] for i in range(n)}
rs = []
for _ in range(n - 1):
r = [0] + xs[:]
rs.append([[r[i], r[n - 1 - i]] for i in range(n // 2)])
xs = rot(xs)
ans = []
for r in rs:
day = []
for a, b in r:
if dct[a][0] > dct[a][1]:
day.append((b, a))
dct[a][1] += 1
dct[b][0] += 1
else:
day.append((a, b))
dct[a][0] += 1
dct[b][1] += 1
ans.append(day)
print(ans)
To embed this program on your website, copy the following code and paste it into your website's HTML: