#include <bits/stdc++.h>
using namespace std;
int c[100];
struct my {
  int x;
  int y;
} pos[1000005];
struct my1 {
  int x1, y1;
  int x2, y2;
} ans[1000005];
int a[105][105];
int b[105][105];
int main() {
  int n, cnt, m;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= c[i]; j++) {
        int tmp;
        scanf("%d", &tmp);
        b[i][j] = tmp;
        pos[tmp].x = i;
        pos[tmp].y = j;
      }
    cnt = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= c[i]; j++) a[i][j] = ++cnt;
    m = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= c[i]; j++) {
        if (a[i][j] != b[i][j]) {
          my t;
          int tt;
          int x = a[i][j];
          int y = b[i][j];
          t = pos[x];
          pos[x] = pos[y];
          pos[y] = t;
          b[i][j] = a[i][j];
          b[pos[y].x][pos[y].y] = y;
          m++;
          ans[m].x1 = i;
          ans[m].y1 = j;
          ans[m].x2 = pos[y].x;
          ans[m].y2 = pos[y].y;
        }
      }
    printf("%d\n", m);
    for (int i = 1; i <= m; i++)
      printf("%d %d %d %d\n", ans[i].x1, ans[i].y1, ans[i].x2, ans[i].y2);
  }
  return 0;
}
