eolymp
bolt
Try our new interface for solving problems

Exam

Dislike of philosophy brings people together, the need to take the exam especially. But the main thing is a clear sense of reluctance to prepare for it. --- \textit{See, Ira, you come to the teacher and propose him such a thing: we have }\textbf{18}\textit{ tickets, they lie face down. Let us turn over }\textbf{K}\textit{ of them, then you have them all properly shued and put in one pile. After that I, I mean you, close your eyes and have to divide them into two piles so that they will have the same number of tickets with their faces up. Then you are allowed to swap any two tickets in the first pile, turn over one ticket in the first pile, and permanently move the tickets from the first pile to the second. You're doing it with your eyes closed and don't have any information about the status of tickets other than that you know the number }\textbf{K}\textit{ and remember all your actions.} --- \textit{Okay, so what?} --- \textit{So, if you will succeed, the teacher gives you the opportunity to answer any of the open tickets. } --- \textit{And if not? } --- \textit{We'll have to believe in a miracle. } --- \textit{Why don't you try it yourself? } --- \textit{Not that I have a good reputation. } --- \textit{So you want to spoil mine? } --- \textit{Oh, three times.} \InputFile Given only an even integer \textbf{K} (\textbf{0} ≤ \textbf{K} ≤ \textbf{18}) --- the number of cards flipped face-up (initially all \textbf{18} tickets are in the first pile). \OutputFile If you can not separate tickets into two non-empty piles as needed, your output should be \textbf{-1}. Otherwise, the first line should contain the number of actions \textbf{Q} to make (\textbf{0} ≤ \textbf{Q} ≤ \textbf{2^9+36}). Further, in \textbf{Q} rows, describe the procedure. Each line should contain the command of one of three types: \begin{itemize} \item \textbf{swap i j} --- swap tickets at positions \textbf{i} and \textbf{j} first pile. \item \textbf{rev i} --- turn over the ticket in position \textbf{i} in first pile. \item \textbf{out i} --- Move a ticket in position \textbf{i} from the first pile to the second. After this operation, positions all tickets in the rst pile, starting from the \textbf{(i+1)}-th, will decrease by 1. \end{itemize} Piles should be non-empty and contain the same number of open tickets, \textbf{1} ≤ \textbf{i} ≠ \textbf{j} ≤ \textbf{18}, and both \textbf{i} and \textbf{j} should be less than current size of first pile.
Time limit 1 second
Memory limit 256 MiB
Input example #1
18
Output example #1
9
out 1
out 1
out 1
out 1
out 1
out 1
out 1
out 1
out 1