#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long* len = new long long[n];
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    cin >> len[i];
    s += len[i];
  }
  long long* elementsI = new long long[s + 1];
  long long* elementsJ = new long long[s + 1];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < len[i]; j++) {
      long long el;
      cin >> el;
      elementsI[el] = i;
      elementsJ[el] = j;
    }
  }
  long long row = 0;
  long long col = 0;
  long long count = 0;
  vector<long long> swaps;
  for (long long el = 1; el <= s; el++) {
    if (elementsI[el] != row || elementsJ[el] != col) {
      ++count;
      swaps.push_back(row + 1);
      swaps.push_back(col + 1);
      swaps.push_back(elementsI[el] + 1);
      swaps.push_back(elementsJ[el] + 1);
      for (long long k = el + 1; k <= s; k++) {
        if (elementsI[k] == row && elementsJ[k] == col) {
          elementsI[k] = elementsI[el];
          elementsJ[k] = elementsJ[el];
          break;
        }
      }
    }
    ++col;
    if (col == len[row]) {
      ++row;
      col = 0;
    }
  }
  cout << count << endl;
  for (long long i = 0; i < count; i++) {
    cout << swaps[i * 4] << " ";
    cout << swaps[i * 4 + 1] << " ";
    cout << swaps[i * 4 + 2] << " ";
    cout << swaps[i * 4 + 3] << endl;
  }
  return 0;
  long long a, b, k;
  cin >> a >> b >> k;
  int minutes[1500];
  long long* hist = new long long[b + 1];
  for (long long i = 0; i <= b; i++) {
    hist[i] = 1;
  }
  for (long long i = 2; i * i <= b; i++) {
    for (long long j = i * 2; j <= b; j += i) {
      hist[j] = 0;
    }
  }
  hist[0] = hist[1] = 0;
  for (long long i = 1; i <= b; i++) {
    hist[i] += hist[i - 1];
  }
  if (hist[b] - hist[a - 1] < k) {
    cout << "-1";
    return 0;
  }
  long long pos = a;
  long long l = 1;
  while ((pos + l - 1) <= b) {
    if (hist[pos + l - 1] - hist[pos - 1] < k) {
      ++l;
    } else {
      ++pos;
    }
  }
  cout << l;
  return 0;
}
