Hello dear friends! Just wanted to share few things with you all. This is the worst question on Codeforces ever (https://codeforces.me/problemset/problem/1341/C). I haven't seen a more complicated question than this. Seriously one would rather leave competetive programming than sit and solve this question. Codeforces should delete this question and blacklist the person who created this. Upvote to get this man suspended @Aleks5d