eolymp
bolt
Try our new interface for solving problems
Problems

Missing Pages

Missing Pages

Long ago, there were periodicals called newspapers, and these newspapers were printed on paper, and people used to read them, and perhaps even share them. One unfortunate thing about this form of media is that every so often, someone would like an article so much, they would take it with them, leaving the rest of the newspaper behind for others to enjoy. Unfortunately, because of the way that paper was folded, not only would the page with that article be gone, so would the page on the reverse side and also two other pages that were physically on the same sheet of folded paper. For this problem we assume the classic approach is used for folding paper to make a booklet that has a number of pages that is a multiple of four. As an example, a newspaper with \textbf{12} pages would be made of three sheets of paper (see figure below). One sheet would have pages \textbf{1} and \textbf{12} printed on one side, and pages \textbf{2} and \textbf{11} printed on the other. Another piece of paper would have pages \textbf{3} and \textbf{10} printed on one side and \textbf{4} and \textbf{9} printed on the other. The third sheet would have pages \textbf{5}, \textbf{6}, \textbf{7}, and \textbf{8}. \includegraphics{https://static.e-olymp.com/content/bf/bfd701664970ab52e3e1601600e3c004375f2bf9.jpg} When one numbered page is taken from the newspaper, the question is what other pages disappear. \InputFile Each test case will be described with two integers \textbf{N} and \textbf{P}, on a line, where \textbf{4} ≤ \textbf{N} ≤ \textbf{1000} is a multiple of four that designates the length of the newspaper in terms of numbered pages, and \textbf{1} ≤ \textbf{P} ≤ \textbf{N} is a page that has been taken. The end of the input is designated by a line containing only the value \textbf{0}. \OutputFile For each case, output, in increasing order, the page numbers for the other three pages that will be missing.
Time limit 1 second
Memory limit 64 MiB
Input example #1
12 2
12 9
8 3
0
Output example #1
1 11 12
3 4 10
4 5 6
Source ACM Mid-Central Regional Programming Contest 2013