func_code_string: #include <bits/stdc++.h>   int n, k, a, b, c, d;   std::vector<int> first_path;   std::vector<int> second_path;   bool first_reversed = false;   bool second_reversed = false;   bool failed = false;   void read() {     scanf( %d %d n%d %d %d %d , &n, &k, &a, &b, &c, &d);     --a;     --b;     --c;     --d;     first_path.resize(n);     second_path.resize(n);   }   void fill_with_everything_except(std::vector<int>::iterator begin,                                    std::vector<int>::iterator end,                                    const std::vector<int> &except) {     for (int i = 0; begin != end; ++begin, ++i) {       while (find(except.begin(), except.end(), i) != except.end()) {         ++i;       }       *begin = i;     }   }   void solve() {     if (a > b) {       std::swap(a, b);       first_reversed = true;     }     if (c > d) {       std::swap(c, d);       second_reversed = true;     }     first_path[0] = a;     first_path[n - 1] = b;     if (a == c && b == d) {       fill_with_everything_except(next(begin(first_path)), prev(end(first_path)),                                   std::vector<int>{a, b});       copy(begin(first_path), end(first_path), begin(second_path));     } else {       if (k < n) {         failed = true;         return;       }       if (a == c) {         fill_with_everything_except(next(begin(first_path)),                                     prev(prev(end(first_path))),                                     std::vector<int>{a, b, d});         first_path[n - 2] = d;         copy(begin(first_path), end(first_path), begin(second_path));         std::swap(second_path[n - 1], second_path[n - 2]);       } else if (b == d) {         fill_with_everything_except(next(next(begin(first_path))),                                     prev(end(first_path)),                                     std::vector<int>{a, b, c});         first_path[1] = c;         copy(begin(first_path), end(first_path), begin(second_path));         std::swap(second_path[0], second_path[1]);       } else {         if (k < n + 1 || n == 4) {           failed = true;           return;         }         fill_with_everything_except(next(next(begin(first_path))),                                     prev(prev(end(first_path))),                                     std::vector<int>{a, b, c, d});         first_path[1] = c;         first_path[n - 2] = d;         copy(begin(first_path), end(first_path), begin(second_path));         std::swap(second_path[0], second_path[1]);         std::swap(second_path[n - 1], second_path[n - 2]);       }     }     if (first_reversed) {       reverse(begin(first_path), end(first_path));     }     if (second_reversed) {       reverse(begin(second_path), end(second_path));     }   }   void print() {     if (failed) {       printf( -1 n );     } else {       for (int i = 0; i < n; ++i) {         printf( %d  , first_path[i] + 1);       }       printf(  n );       for (int i = 0; i < n; ++i) {         printf( %d  , second_path[i] + 1);       }     }   }   int main() {     read();     solve();     print();     return 0;   }   