#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, a, max = 0;
  scanf("%d", &n);
  int arr[n], posa[5000][2], answer[5000][4], posi[50][50];
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < arr[i]; j++) {
      scanf("%d", &posi[i][j]);
      posa[posi[i][j]][0] = i;
      posa[posi[i][j]][1] = j;
      if (max < posi[i][j]) max = posi[i][j];
    }
  }
  int k = 0, cnt = 0, l = 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < arr[i]; j++) {
      if (posi[i][j] == l) {
      } else {
        answer[k][0] = i;
        answer[k][1] = j;
        answer[k][2] = posa[l][0];
        answer[k][3] = posa[l][1];
        posa[posi[i][j]][0] = posa[l][0];
        posa[posi[i][j]][1] = posa[l][1];
        posi[posa[l][0]][posa[l][1]] = posi[i][j];
        cnt++;
        k++;
      }
      l++;
    }
  }
  printf("%d\n", cnt);
  for (i = 0; i < cnt; i++) {
    printf("%d %d %d %d\n", answer[i][0] + 1, answer[i][1] + 1,
           answer[i][2] + 1, answer[i][3] + 1);
  }
  return 0;
}
