#include <bits/stdc++.h>
using namespace std;
int a[66];
int k[66][66];
struct sy {
  int x, y;
} b[100000];
struct ac {
  int a, b, c, d;
  ac(int aa, int bb, int cc, int dd) : a(aa), b(bb), c(cc), d(dd) {}
};
int s;
int main() {
  int i, j, n, m, tot = 0;
  cin >> n;
  s = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    s += a[i];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= a[i]; j++) {
      cin >> k[i][j];
      b[k[i][j]].x = i;
      b[k[i][j]].y = j;
    }
  }
  vector<ac> ans;
  for (i = 0; i < s; i++) {
    int x = n, y = a[n];
    int tmp = i;
    while (tmp) {
      if (tmp >= y) {
        tmp -= y;
        x--;
        y = a[x];
      } else {
        y -= tmp;
        tmp = 0;
      }
    }
    int z = s - i;
    if (k[x][y] != z) {
      ans.push_back(ac(b[z].x, b[z].y, x, y));
      int tp = k[x][y];
      swap(k[x][y], k[b[z].x][b[z].y]);
      b[tp].x = b[z].x;
      b[tp].y = b[z].y;
    }
  }
  cout << ans.size() << endl;
  for (i = 0; i < ans.size(); i++) {
    cout << ans[i].a << ' ' << ans[i].b << ' ' << ans[i].c << ' ' << ans[i].d
         << endl;
  }
}
