#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, xx, yy, val;
} brr[110000];
int tot, arr[100][100];
int n, col[100], sum[100], ans;
int cmp(node a, node b) { return a.val > b.val; }
int main() {
  int i, j, k;
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; ++i) {
      scanf("%d", &col[i]);
      sum[i] = col[i] + sum[i - 1];
    }
    for (i = 1; i <= n; ++i)
      for (j = 1; j <= col[i]; ++j) scanf("%d", &arr[i][j]);
    tot = 0;
    for (i = 1; i <= n; ++i)
      for (j = 1; j <= col[i]; ++j) {
        k = sum[i - 1] + j;
        int isok = 0;
        for (int ii = i; ii <= n; ++ii)
          for (int jj = (i == ii ? j : 1); jj <= col[ii]; ++jj) {
            if (isok) break;
            if (arr[ii][jj] == k) {
              if (ii != i || jj != j) {
                brr[++tot].x = ii;
                brr[tot].y = jj;
                brr[tot].xx = i;
                brr[tot].yy = j;
                arr[ii][jj] = arr[i][j];
              }
              isok = 1;
            }
          }
      }
    printf("%d\n", tot);
    for (i = 1; i <= tot; ++i)
      printf("%d %d %d %d\n", brr[i].x, brr[i].y, brr[i].xx, brr[i].yy);
  }
}
