#include <bits/stdc++.h>
int a, z, k;
int b[109];
int c[109][109];
typedef struct {
  int x, y;
} daw;
daw v[10009];
daw w[2][10009];
int main() {
  scanf("%d", &a);
  for (int i = 0; i < a; i++) scanf("%d", &b[i]);
  for (int i = 0; i < a; i++)
    for (int j = 0; j < b[i]; j++) {
      scanf("%d", &c[i][j]);
      v[c[i][j]].x = i;
      v[c[i][j]].y = j;
    }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b[i]; j++) {
      z++;
      if (c[i][j] == z)
        continue;
      else {
        w[0][k].x = i;
        w[0][k].y = j;
        w[1][k].x = v[z].x;
        w[1][k].y = v[z].y;
        k++;
        c[v[z].x][v[z].y] = c[i][j];
        v[c[i][j]].x = v[z].x;
        v[c[i][j]].y = v[z].y;
      }
    }
  }
  printf("%d\n", k);
  for (int i = 0; i < k; i++)
    printf("%d %d %d %d\n", w[0][i].x + 1, w[0][i].y + 1, w[1][i].x + 1,
           w[1][i].y + 1);
  getchar();
  getchar();
}
