#include <bits/stdc++.h>
int main() {
  int n, s = 0, i, j, h, k, final, ban = 1, cont, temp;
  scanf("%d", &n);
  int celdas[n];
  int **tabla = (int **)malloc(sizeof(int) * n);
  int **aux = (int **)malloc(sizeof(int) * n);
  int **aux2 = (int **)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) {
    scanf("%d", &celdas[i]);
    s += celdas[i];
    tabla[i] = (int *)malloc(sizeof(int) * celdas[i]);
    aux[i] = (int *)malloc(sizeof(int) * celdas[i]);
    aux2[i] = (int *)malloc(sizeof(int) * celdas[i]);
  }
  cont = 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < celdas[i]; j++) {
      scanf("%d", &tabla[i][j]);
      aux2[i][j] = tabla[i][j];
      aux[i][j] = cont;
      cont++;
    }
  }
  cont = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < celdas[i]; j++) {
      if (aux[i][j] != tabla[i][j] && aux[i][j] != 0 && tabla[i][j] != 0) {
        for (h = 0; h < n; h++) {
          for (k = 0; k < celdas[h]; k++) {
            if (aux[i][j] == tabla[h][k]) {
              tabla[h][k] = tabla[i][j];
              tabla[i][j] = aux[i][j];
              h = n;
              k = celdas[h];
              cont++;
            }
          }
        }
      }
    }
  }
  printf("%d\n", cont);
  for (i = 0; i < n; i++) {
    for (j = 0; j < celdas[i]; j++) {
      if (aux[i][j] != aux2[i][j] && aux[i][j] != 0 && aux2[i][j] != 0) {
        for (h = 0; h < n; h++) {
          for (k = 0; k < celdas[h]; k++) {
            if (aux[i][j] == aux2[h][k]) {
              printf("%d %d %d %d\n", i + 1, j + 1, h + 1, k + 1);
              aux2[h][k] = aux2[i][j];
              aux2[i][j] = aux[i][j];
              h = n;
              k = celdas[h];
              cont++;
            }
          }
        }
      }
    }
  }
  return 0;
}
