#include <bits/stdc++.h>
time_t waktu = clock();
void gettime() {
  printf("\nTime : %.2lf", (clock() - waktu) / double(CLOCKS_PER_SEC));
}
bool comp(int a, int b) { return (a > b); }
using namespace std;
int main() {
  int n, data[52][52] = {}, cek[3000][2] = {}, x, y, z, hasil[3000][4] = {}, i,
         j, k, l;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &data[i][0]);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= data[i][0]; j++) {
      scanf("%d", &data[i][j]);
      cek[data[i][j]][0] = i;
      cek[data[i][j]][1] = j;
    }
  }
  x = 0;
  y = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= data[i][0]; j++) {
      if (data[i][j] != y) {
        hasil[x][0] = i;
        hasil[x][1] = j;
        hasil[x][2] = cek[y][0];
        hasil[x][3] = cek[y][1];
        cek[data[i][j]][0] = cek[y][0];
        cek[data[i][j]][1] = cek[y][1];
        data[cek[y][0]][cek[y][1]] = data[i][j];
        x++;
      }
      y++;
    }
  }
  printf("%d\n", x);
  for (i = 0; i < x; i++) {
    printf("%d %d %d %d\n", hasil[i][0], hasil[i][1], hasil[i][2], hasil[i][3]);
  }
  return 0;
}
