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.
— See, Ira, you come to the teacher and propose him such a thing: we have 18 tickets, they lie face down. Let us turn over K 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 K and remember all your actions. — Okay, so what? — So, if you will succeed, the teacher gives you the opportunity to answer any of the open tickets. — And if not? — We'll have to believe in a miracle. — Why don't you try it yourself? — Not that I have a good reputation. — So you want to spoil mine? — Oh, three times.
Input
Given only an even integer K (0 ≤ K ≤ 18) — the number of cards flipped face-up (initially all 18 tickets are in the first pile).
Output
If you can not separate tickets into two non-empty piles as needed, your output should be -1. Otherwise, the first line should contain the number of actions Q to make (0 ≤ Q ≤ 2^9+36). Further, in Q rows, describe the procedure. Each line should contain the command of one of three types:
swap i j — swap tickets at positions i and j first pile.
rev i — turn over the ticket in position i in first pile.
out i — Move a ticket in position i from the first pile to the second. After this operation, positions all tickets in the rst pile, starting from the (i+1)-th, will decrease by 1.
Piles should be non-empty and contain the same number of open tickets, 1 ≤ i ≠ j ≤ 18, and both i and j should be less than current size of first pile.