Arkady playlist initially consist n song numerate 1 n order appear playlist Arkady start listen song playlist start song 1 the playlist cycle ie listening song Arkady continue listen beginningEach song genre a_i positive integer let Arkady finish listen song genre y genre nexttolast listen song x if operatornamegcdx y 1 delete listen song genre y playlist after continue listen normally skip deleted song forget song listen in word delete song can not delete song immediatelyHere operatornamegcdx y denote great common divisor GCD integer x yFor example initial song genre 5 9 2 10 15 playlist convert follow 5 9 2 10 15 5 9 2 10 15 5 2 10 15 operatornamegcd5 9 1 5 2 10 15 5 2 10 15 5 2 10 15 5 2 10 15 5 2 10 15 5 10 15 operatornamegcd5 2 1 5 10 15 5 10 15 the bold number represent play song Note song delete Arkady forget listen previous songsgiven initial playlist determine song eventually delete order song delete