#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
#pragma comment(linker, "/STACK:256000000")
int *primes = new int[80000];
int prcount = 0;
int *u;
int N = 1000001;
void prepare() {
  u = new int[N];
  memset(u, 0, N * 4);
  for (int i = 2; i < N; i++) {
    if (u[i] == 0) {
      primes[prcount++] = i;
      u[i] = i;
    }
    for (int j = 0; j < prcount && i * primes[j] < N && primes[j] <= u[i]; j++)
      u[i * primes[j]] = primes[j];
  }
}
long long nod(long long a, long long b) {
  while (a) {
    b %= a;
    long long t = b;
    b = a;
    a = t;
  }
  return b;
}
long long nok(long long a, long long b) { return a / nod(a, b) * b; }
int main() {
  int n;
  int a[50][50];
  int c[50];
  int b[50][50];
  cin >> n;
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    s += c[i];
  }
  pair<int, int> pos[10000];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < c[i]; j++) {
      cin >> a[i][j];
      pos[a[i][j]] = make_pair(i, j);
    }
  int k = 1;
  vector<pair<pair<int, int>, pair<int, int> > > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      if (a[i][j] != k) {
        int t = a[i][j];
        v.push_back(make_pair(make_pair(i, j), pos[k]));
        swap(pos[k], pos[t]);
        a[pos[t].first][pos[t].second] = t;
        a[i][j] = k;
      }
      k++;
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first.first + 1 << " " << v[i].first.second + 1 << " "
         << v[i].second.first + 1 << " " << v[i].second.second + 1;
    cout << '\n';
  }
  return 0;
}
