zero = ["A", "E"] one = ["B"] two = ["C"] three = ["D"] inputK = gets K = inputK.to_i ii = 0 iii = 0 memory = "" for i in 0..(K-1) do ii = i%4 case ii when 0 then memory = zero[0] zero.delete_at(0) when 1 then memory = one[0] one.delete_at(0) when 2 then memory = two[0] two.delete_at(0) when 3 then memory = three[0] three.delete_at(0) end iii = (i+1)%4 case iii when 0 then zero.push(memory) when 1 then one.push(memory) when 2 then two.push(memory) when 3 then three.push(memory) end end zero = zero.join('') one = one.join('') two = two.join('') three = three.join('') puts zero puts one puts two puts three