#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > T;   int n, sum;   vector<pair<int, int> > loc;   void input();   void solve();   int main() {     input();     solve();     return 0;   }   void input() {     assert(scanf( %d , &n) == 1);     T.resize(n);     for (int i = 0; i < n; i++) {       int c;       assert(scanf( %d , &c) == 1);       sum += c;       T[i].resize(c);     }     loc.resize(sum);     for (int i = 0; i < n; i++)       for (int j = 0; j < ((int)(T[i].size())); j++) {         assert(scanf( %d , &T[i][j]) == 1);         loc[T[i][j] - 1] = make_pair(i, j);       }   }   void solve() {     vector<int> ans[4];     int cnt = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < ((int)(T[i].size())); j++) {         int x = loc[cnt].first, y = loc[cnt].second;         if (i != x || j != y) {           ans[0].push_back(i + 1);           ans[1].push_back(j + 1);           ans[2].push_back(x + 1);           ans[3].push_back(y + 1);           swap(T[i][j], T[x][y]);           swap(loc[T[i][j] - 1], loc[T[x][y] - 1]);         }         cnt++;       }     cout << ((int)(ans[0].size())) << endl;     for (int i = 0; i < ((int)(ans[0].size())); i++) {       for (int j = 0; j < 4; j++) cout << ans[j][i] <<    ;       cout << endl;     }   }   