func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 50 + 10;   int n, m, vis[maxn][maxn], need[maxn][maxn];   struct node {     int x, y, a, b;   } p[maxn];   vector<node> vec;   inline void move(int id, int x, int y) {     vec.push_back((node){p[id].x, p[id].y, p[id].x + x, p[id].y + y});     vis[p[id].x][p[id].y] = 0;     p[id].x += x;     p[id].y += y;     vis[p[id].x][p[id].y] = id;   }   inline void work1() {     int cnt = 0;     for (int i = 1; i <= n; ++i)       if (vis[1][i]) {         ++cnt;         int id = vis[1][i];         while (p[id].y > cnt) move(id, 0, -1);       }     for (int i = 2; i <= n; ++i)       for (int j = n; j; --j)         if (vis[i][j]) {           ++cnt;           int id = vis[i][j];           while (p[id].y < cnt) move(id, 0, 1);           while (p[id].x > 1) move(id, -1, 0);           while (p[id].y > cnt) move(id, 0, -1);         }   }   inline void work2() {     int cnt = 0;     for (int i = n; i > 2; --i)       for (int j = n; j; --j)         if (need[i][j]) {           int id = need[i][j];           move(id, 1, 0);           while (p[id].y < j) move(id, 0, 1);           while (p[id].y > j) move(id, 0, -1);           while (p[id].x < i) move(id, 1, 0);         }     for (int i = 1; i <= n; ++i)       if (vis[1][i]) {         ++cnt;         int id = vis[1][i];         while (p[id].y > cnt) move(id, 0, -1);       }     for (int i = n, cntt = cnt; i; --i)       for (int j = 1; j <= 2; ++j)         if (need[j][i]) {           int id = need[j][i];           move(id, 1, 0);           for (int k = p[id].y + 1; k <= cntt; ++k) move(vis[1][k], 0, -1);           while (p[id].y < cntt) move(id, 0, 1);           move(id, -1, 0);           --cntt;         }     for (int i = 1; i <= cnt; ++i)       if (p[vis[1][i]].a == 2) move(vis[1][i], 1, 0);     for (int i = 1; i <= 2; ++i) {       for (int j = 1; j <= n; ++j)         if (vis[i][j]) {           int id = vis[i][j];           while (p[id].y > p[id].b) move(id, 0, -1);         }       for (int j = n; j; --j)         if (vis[i][j]) {           int id = vis[i][j];           while (p[id].y < p[id].b) move(id, 0, 1);         }     }   }   int main() {     cin >> n >> m;     if (n == 1) {       cout << 0 << endl;       return 0;     }     for (int i = 1; i <= m; ++i) {       cin >> p[i].x >> p[i].y;       vis[p[i].x][p[i].y] = i;     }     for (int i = 1; i <= m; ++i) {       cin >> p[i].a >> p[i].b;       need[p[i].a][p[i].b] = i;     }     work1();     work2();     cout << vec.size() << endl;     for (int i = 0; i < vec.size(); ++i)       cout << vec[i].x <<     << vec[i].y <<     << vec[i].a <<     << vec[i].b            << endl;     return 0;   }   