#include <bits/stdc++.h>
using namespace std;
int c[50005];
struct Data {
  int x, y, val;
  Data(int xx, int yy, int vv) : x(xx), y(yy), val(vv) {}
  Data() {}
  bool operator<(Data d1) const { return val < d1.val; }
} v[50005], s[50005], pos[50005], aux[50005];
int ady[55][55];
int main() {
  int n, i, j, x, len = 0, ans = 0;
  scanf("%d", &n);
  for (i = 0; i < n && scanf("%d", &c[i]); ++i)
    ;
  memset(pos, 0, sizeof(pos));
  for (i = 0; i < n; ++i) {
    for (j = 0; j < c[i] && scanf("%d", &x); ++j) {
      v[len] = Data(i + 1, j + 1, x);
      pos[x] = Data(i + 1, j + 1, x);
      aux[++len] = Data(i + 1, j + 1, x);
      ady[i + 1][j + 1] = x;
    }
  }
  vector<pair<pair<int, int>, pair<int, int> > > vv;
  for (i = 1; i <= len; ++i) {
    if (pos[i].x == aux[i].x && pos[i].y == aux[i].y) {
      continue;
    } else {
      ans++;
      vv.push_back(make_pair(make_pair(aux[i].x, aux[i].y),
                             make_pair(pos[i].x, pos[i].y)));
      int c = ady[aux[i].x][aux[i].y];
      swap(ady[aux[i].x][aux[i].y], ady[pos[i].x][pos[i].y]);
      swap(pos[i], pos[c]);
    }
  }
  printf("%d\n", ans);
  for (i = 0; i < ans; ++i) {
    printf("%d %d %d %d\n", vv[i].first.first, vv[i].first.second,
           vv[i].second.first, vv[i].second.second);
  }
  return 0;
}
