#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const long long INFLL = 1e18 + 1;   const int MAX = 200001;   const long long MOD = 1000000007;   long long inq(long long k, long long q) {     if (q == 0) return 1;     long long l = inq(k, q / 2);     if (q % 2 == 0)       return l * l % MOD;     else       return l * l * k % MOD;   }   long long gcd(long long a, long long b) {     if (a < b) swap(a, b);     if (b == 0) return a;     return gcd(b, a % b);   }   long long cubr(long long a) {     long long l = -1, r = 1e6 + 2;     while (l < r - 1) {       long long mid = (l + r) / 2;       if (mid * mid * mid > a)         r = mid;       else         l = mid;     }     return l;   }   long long max(long long a, long long b) {     if (a > b) return a;     return b;   }   long long min(long long a, long long b) { return -1 * max(-a, -b); }   long long possible(long long q) {     if (q == INF) return -1;     return q;   }   bool correct(int x, int xx) {     if (x < 0) return 0;     if (x >= xx) return 0;     return 1;   }   long long dsumm(long long x, long long k) {     long long y = 1;     long long z = 0;     for (int i = 0; y < 1e18; i++) {       z += x / y % k;       y *= k;     }     return z;   }   long long dcount(long long x) {     long long y = 1;     long long z = 0;     int c[100];     for (int i = 0; i < 10; i++) c[i] = 0;     for (int i = 0; x > 0; i++) {       if (c[x / y % 10] == 0) z++;       c[x / y % 10] = 1;       x /= 10;     }     return z;   }   long long lg10(long long x) {     if (x == 0) return 0;     return lg10(x / 10) + 1;   }   string months[12] = { January ,    February ,  March ,     April ,                         May ,        June ,      July ,      August ,                         September ,  October ,   November ,  December };   int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   vector<int> cx, cy;   long long n, m;   long long x[50];   long long y[50];   long long x2[50];   long long y2[50];   long long a[52][52];   long long b[52][52];   vector<pair<pair<int, int>, pair<int, int>>> ans1, ans2, ans3;   void Move_left_p1(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (a[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j > 1) {       if (a[i][j - 1] == 0) {         ans1.push_back({{i, j}, {i, j - 1}});         j--;         a[i][j] = num;         a[i][j + 1] = 0;       } else         break;     }   }   void Move_right_p1(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (a[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j < n) {       if (a[i][j + 1] == 0) {         ans1.push_back({{i, j}, {i, j + 1}});         j++;         a[i][j] = num;         a[i][j - 1] = 0;       } else         break;     }   }   void Move_up_p1(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (a[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (i > 1) {       if (a[i - 1][j] == 0) {         ans1.push_back({{i, j}, {i - 1, j}});         i--;         a[i][j] = num;         a[i + 1][j] = 0;       } else         break;     }   }   void collectA() {     for (int i = 1; i <= 1; i++) {       for (int j = 1; j <= n; j++) {         if (a[i][j] != 0) {           Move_left_p1(a[i][j]);         }       }     }     for (int i = 2; i <= n; i++) {       for (int j = n; j >= 1; j--) {         if (a[i][j] != 0) {           int id = a[i][j];           Move_right_p1(id);           Move_up_p1(id);           Move_left_p1(id);         }       }     }   }   void Move_left_p3(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (b[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j > 1) {       if (b[i][j - 1] == 0) {         ans3.push_back({{i, j}, {i, j - 1}});         j--;         b[i][j] = num;         b[i][j + 1] = 0;       } else         break;     }   }   void Move_right_p3(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (b[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j < n) {       if (b[i][j + 1] == 0) {         ans3.push_back({{i, j}, {i, j + 1}});         j++;         b[i][j] = num;         b[i][j - 1] = 0;       } else         break;     }   }   void Move_up_p3(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (b[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (i > 1) {       if (b[i - 1][j] == 0) {         ans3.push_back({{i, j}, {i - 1, j}});         i--;         b[i][j] = num;         b[i + 1][j] = 0;       } else         break;     }   }   void collectB() {     for (int i = 1; i <= 1; i++) {       for (int j = 1; j <= n; j++) {         if (b[i][j] != 0) {           Move_left_p3(b[i][j]);         }       }     }     for (int i = 2; i <= n; i++) {       for (int j = n; j >= 1; j--) {         if (b[i][j] != 0) {           int id = b[i][j];           Move_right_p3(id);           Move_up_p3(id);           Move_left_p3(id);         }       }     }   }   void Move_right_p2(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (a[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j < n) {       if (a[i][j + 1] == 0) {         ans2.push_back({{i, j}, {i, j + 1}});         j++;         a[i][j] = num;         a[i][j - 1] = 0;       } else         break;     }   }   void Move_left_p2(int num) {     int i = 0;     int j = 0;     for (int i1 = 1; i1 <= n; i1++) {       for (int j1 = 1; j1 <= n; j1++) {         if (a[i1][j1] == num) {           i = i1;           j = j1;           break;         }       }     }     while (j > 1) {       if (a[i][j - 1] == 0) {         ans2.push_back({{i, j}, {i, j - 1}});         j--;         a[i][j] = num;         a[i][j + 1] = 0;       } else         break;     }   }   void Move_right_all(int line) {     for (int i = n; i >= 1; i--) {       if (a[line][i] != 0) {         int id = a[line][i];         Move_right_p2(id);       }     }   }   void Push(int id) {     for (int i = 1; i <= n; i++) {       if (a[2][i] == id) {         a[1][i] = id;         a[2][i] = 0;         ans2.push_back({{2, i}, {1, i}});         Move_left_p2(id);       }     }   }   void reOrder() {     for (int i = 1; i <= m; i++) {       a[2][i] = a[1][i];       a[1][i] = 0;       ans2.push_back({{1, i}, {2, i}});     }     Move_right_all(2);     for (int i = 1; i <= m; i++) {       int id = b[1][i];       Push(id);       Move_right_all(2);     }   }   int main() {     cin >> n >> m;     if (n == 1) {       cout << 0;       return 0;     }     for (int(i) = 0; (i) != (m); i++) {       cin >> x[i] >> y[i];       a[x[i]][y[i]] = i + 1;     }     collectA();     for (int(i) = 0; (i) != (m); i++) {       cin >> x2[i] >> y2[i];       b[x2[i]][y2[i]] = i + 1;     }     collectB();     reOrder();     if (ans1.size() + ans2.size() + ans3.size() < 10800) {       cout << ans1.size() + ans2.size() + ans3.size() <<   n ;       for (int(i) = 0; (i) != (ans1.size()); i++) {         cout << ans1[i].first.first <<     << ans1[i].first.second <<                  << ans1[i].second.first <<     << ans1[i].second.second <<   n ;       }       for (int(i) = 0; (i) != (ans2.size()); i++) {         cout << ans2[i].first.first <<     << ans2[i].first.second <<                  << ans2[i].second.first <<     << ans2[i].second.second <<   n ;       }       for (int(i) = (ans3.size()) - 1; (i) != -1; i--) {         cout << ans3[i].second.first <<     << ans3[i].second.second <<                  << ans3[i].first.first <<     << ans3[i].first.second <<   n ;       }     } else {       for (int i = 1; i <= 50; i++) {         for (int j = 1; j <= 50; j++) {           a[i][j] = 0;           b[i][j] = 0;         }       }       ans1.resize(0);       ans2.resize(0);       ans3.resize(0);       for (int(i) = 0; (i) != (m); i++) {         a[n + 1 - x[i]][y[i]] = i + 1;       }       collectA();       for (int(i) = 0; (i) != (m); i++) {         b[n + 1 - x2[i]][y2[i]] = i + 1;       }       collectB();       reOrder();       if (ans1.size() + ans2.size() + ans3.size() < 10800) {         cout << ans1.size() + ans2.size() + ans3.size() <<   n ;         for (int(i) = 0; (i) != (ans1.size()); i++) {           cout << n + 1 - ans1[i].first.first <<     << ans1[i].first.second                <<     << n + 1 - ans1[i].second.first <<                    << ans1[i].second.second <<   n ;         }         for (int(i) = 0; (i) != (ans2.size()); i++) {           cout << n + 1 - ans2[i].first.first <<     << ans2[i].first.second                <<     << n + 1 - ans2[i].second.first <<                    << ans2[i].second.second <<   n ;         }         for (int(i) = (ans3.size()) - 1; (i) != -1; i--) {           cout << n + 1 - ans3[i].second.first <<     << ans3[i].second.second                <<     << n + 1 - ans3[i].first.first <<                    << ans3[i].first.second <<   n ;         }       } else {         for (int i = 1; i <= 50; i++) {           for (int j = 1; j <= 50; j++) {             a[i][j] = 0;             b[i][j] = 0;           }         }         ans1.resize(0);         ans2.resize(0);         ans3.resize(0);         for (int(i) = 0; (i) != (m); i++) {           a[y[i]][x[i]] = i + 1;         }         collectA();         for (int(i) = 0; (i) != (m); i++) {           b[y2[i]][x2[i]] = i + 1;         }         collectB();         reOrder();         if (ans1.size() + ans2.size() + ans3.size() < 10800) {           cout << ans1.size() + ans2.size() + ans3.size() <<   n ;           for (int(i) = 0; (i) != (ans1.size()); i++) {             cout << ans1[i].first.second <<     << ans1[i].first.first <<                      << ans1[i].second.second <<     << ans1[i].second.first <<   n ;           }           for (int(i) = 0; (i) != (ans2.size()); i++) {             cout << ans2[i].first.second <<     << ans2[i].first.first <<                      << ans2[i].second.second <<     << ans2[i].second.first <<   n ;           }           for (int(i) = (ans3.size()) - 1; (i) != -1; i--) {             cout << ans3[i].second.second <<     << ans3[i].second.first <<                      << ans3[i].first.second <<     << ans3[i].first.first <<   n ;           }         } else {           for (int i = 1; i <= 50; i++) {             for (int j = 1; j <= 50; j++) {               a[i][j] = 0;               b[i][j] = 0;             }           }           ans1.resize(0);           ans2.resize(0);           ans3.resize(0);           for (int(i) = 0; (i) != (m); i++) {             a[n + 1 - y[i]][x[i]] = i + 1;           }           collectA();           for (int(i) = 0; (i) != (m); i++) {             b[n + 1 - y2[i]][x2[i]] = i + 1;           }           collectB();           reOrder();           if (ans1.size() + ans2.size() + ans3.size() < 10800) {             cout << ans1.size() + ans2.size() + ans3.size() <<   n ;             for (int(i) = 0; (i) != (ans1.size()); i++) {               cout << n + 1 - ans1[i].first.second <<     << ans1[i].first.first                    <<     << n + 1 - ans1[i].second.second <<                        << ans1[i].second.first <<   n ;             }             for (int(i) = 0; (i) != (ans2.size()); i++) {               cout << n + 1 - ans2[i].first.second <<     << ans2[i].first.first                    <<     << n + 1 - ans2[i].second.second <<                        << ans2[i].second.first <<   n ;             }             for (int(i) = (ans3.size()) - 1; (i) != -1; i--) {               cout << n + 1 - ans3[i].second.second <<     << ans3[i].second.first                    <<     << n + 1 - ans3[i].first.second <<                        << ans3[i].first.first <<   n ;             }           }         }       }     }   }