#include <bits/stdc++.h>
using namespace std;
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int arr[1000][1000];
int rez[5000];
int t1[5000], t2[5000], t3[5000], t4[5000];
int main() {
  int n, sum = 0;
  cin >> n;
  for (int j = 1; j <= n; ++j) cin >> rez[j];
  for (int j = 1; j <= n; ++j) {
    for (int i = 1; i <= rez[j]; ++i) {
      cin >> arr[j][i];
    }
    sum += rez[j];
  }
  int** temp = new int*[10000];
  for (int j = 1; j <= sum; ++j) temp[j] = new int[3];
  int line = 1;
  int i = 1;
  for (int j = 1; j <= n; ++j) {
    for (i = 1; i <= rez[j]; ++i) {
      temp[line][1] = j;
      temp[line][2] = i;
      ++line;
    }
  }
  int c = 1;
  int t;
  int cc = 0;
  for (int k = 1; k <= sum; ++k) {
    for (int j = 1; j <= n; ++j) {
      for (int i = 1; i <= rez[j]; ++i)
        if (arr[j][i] == k && (j != temp[k][1] || i != temp[k][2])) {
          swap(arr[j][i], arr[temp[k][1]][temp[k][2]]);
          ++cc;
          t1[cc] = j;
          t2[cc] = i;
          t3[cc] = temp[k][1];
          t4[cc] = temp[k][2];
        }
    }
  }
  cout << cc << endl;
  for (int j = 1; j <= cc; ++j)
    printf("%i %i %i %i\n", t1[j], t2[j], t3[j], t4[j]);
  return 0;
}
