For the odd n=2l+1 one can prove the statement as follows:
P2=(a1a2)(a2a3)(a3a4)…(a2018a2019)(a2019a1)=m2l+1,
where P=a1a2…a2019. From here it follows that P=a1a2…a2019=s2l+1. Therefore,
a1=(a2a3)(a4a5)…(a2018a2019)P=u2l+1s2l+1=v12l+1,
and the same holds for all ai=vi2l+1, i=2,…,2019. From here it directly follows that
aiaj=vi2l+1vj2l+1=v2l+1.
For even n=2l one can write
P2=(a1a2)(a2a3)(a3a4)…(a2018a2019)(a2019a1)=m2l, where P=a1a2…a2019.
From here it follows that P=ml. Therefore,
a12=(a2a3)(a4a5)…(a2018a2019)P2=u2lm2l=v12l,
and the same holds for all ai2=vi2l, i=2,…,2019. From here it directly follows that
r2l=(a1a2)(a2a3)(a3a4)…(ak−1ak)=a1a22a32…ak−1ak=a1akw2l⇒a1ak=w2lr2l=z2l.