#include <bits/stdc++.h>
using namespace std;
int c[64];
struct Swap {
  int a, b, c, d;
  Swap(int a, int b, int c, int d) : a(a), b(b), c(c), d(d) {}
};
int main() {
  setvbuf(stdin, NULL, _IOFBF, 10000);
  setvbuf(stdout, NULL, _IOFBF, 10000);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
  }
  int arr[64 * 64];
  memset(arr, 0, sizeof(arr));
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= c[i - 1]; ++j) {
      scanf("%d", &arr[cnt++]);
    }
  }
  int perm[64 * 64];
  copy(arr, arr + cnt, perm);
  for (int i = 0; i < cnt; ++i) {
    --perm[i];
  }
  pair<int, int> map[64 * 64];
  int rmap[64][64];
  int idx = 0;
  for (int y = 1; y <= n; ++y) {
    for (int x = 1; x <= c[y - 1]; ++x) {
      map[idx] = make_pair(x, y);
      rmap[y][x] = idx;
      idx++;
    }
  }
  list<Swap> swaps;
  bool marked[64 * 64];
  memset(marked, 0, sizeof(marked));
  for (int i = 0; i < cnt; ++i) {
    if (marked[i]) continue;
    for (int j = i; !marked[j]; j = perm[j]) {
      marked[j] = true;
      if (!marked[perm[j]]) {
        swaps.push_back(Swap(map[i].second, map[i].first, map[perm[j]].second,
                             map[perm[j]].first));
      }
    }
  }
  printf("%d\n", swaps.size());
  for (list<Swap>::iterator it = swaps.begin(); it != swaps.end(); ++it) {
    printf("%d %d %d %d\n", it->a, it->b, it->c, it->d);
    swap(arr[rmap[it->a][it->b]], arr[rmap[it->c][it->d]]);
  }
  return 0;
}
