#include <bits/stdc++.h>
using namespace std;
int numbers[51][51];
int columns[51];
int numberCount[2501];
struct Swap {
  int i;
  int j;
  int x;
  int y;
} swaps[2501];
int main() {
  int n;
  while (cin >> n) {
    int m, x;
    int s = 0;
    int max = 0;
    for (int i = 1; i <= n; i++) {
      cin >> columns[i];
      s++;
    }
    for (int i = 0; i <= s; i++) numberCount[i] = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= columns[i]; j++) {
        cin >> m;
        numbers[i][j] = m;
        numberCount[m]++;
        if (m > max) max = m;
      }
    for (int i = 1; i <= max; i++) {
      numberCount[i] = numberCount[i] + numberCount[i - 1];
    }
    int swapNo = 0;
    m = 1;
    x = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= columns[i]; j++, x++) {
        while (x > numberCount[m]) m++;
        if (numbers[i][j] != m)
          for (int k = i; k <= n; k++)
            for (int l = 1; l <= columns[k]; l++) {
              if (k == i && l <= j) continue;
              if (numbers[k][l] == m) {
                int temp = numbers[i][j];
                numbers[i][j] = numbers[k][l];
                numbers[k][l] = temp;
                swaps[swapNo].i = i;
                swaps[swapNo].j = j;
                swaps[swapNo].x = k;
                swaps[swapNo].y = l;
                swapNo++;
              }
            }
      }
    cout << swapNo << endl;
    for (int i = 0; i < swapNo; i++)
      printf("%d %d %d %d\n", swaps[i].i, swaps[i].j, swaps[i].x, swaps[i].y);
  }
  return 0;
}
