#include <bits/stdc++.h>
using namespace std;
void run();
int main() {
  ios::sync_with_stdio(0);
  run();
}
int n, q, m[100];
int v[100][100];
pair<int, int> p[10001];
void run() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> m[i], q += m[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m[i]; j++) cin >> v[i][j], p[v[i][j]] = {i, j};
  stringstream ops;
  int opc = 0;
  int x = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m[i]; j++, ++x) {
      if (p[x].first != i or p[x].second != j) {
        ops << p[x].first + 1 << " " << p[x].second + 1 << " " << i + 1 << " "
            << j + 1 << endl;
        int u = v[p[x].first][p[x].second];
        int w = v[i][j];
        swap(v[p[x].first][p[x].second], v[i][j]);
        swap(p[u], p[w]);
        ++opc;
      }
    }
  cout << opc << endl << ops.str() << endl;
}
