#include <bits/stdc++.h>
using namespace std;
int c[60];
int grid[60][60];
pair<int, int> m[3000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < c[i]; j++) {
      cin >> grid[i][j];
      grid[i][j]--;
      m[grid[i][j]] = make_pair(i, j);
    }
  vector<int> res1;
  vector<int> res2;
  vector<int> res3;
  vector<int> res4;
  int wanted = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < c[i]; j++, wanted++) {
      int ii = m[wanted].first;
      int jj = m[wanted].second;
      int cur = grid[i][j];
      if (cur == wanted) continue;
      m[cur].first = ii;
      m[cur].second = jj;
      grid[i][j] = wanted;
      grid[ii][jj] = cur;
      res1.push_back(i + 1);
      res2.push_back(j + 1);
      res3.push_back(ii + 1);
      res4.push_back(jj + 1);
    }
  cout << (int)res1.size() << "\n";
  for (int i = 0; i < (int)res1.size(); i++) {
    cout << res1[i] << " " << res2[i] << " " << res3[i] << " " << res4[i]
         << "\n";
  }
  return 0;
}
