#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
vector<vector<int> > v;
pair<int, int> f(int a, int b) {
  int ri = a, rj = b;
  int t = v[a][b];
  for (int i = a; i < v.size(); ++i) {
    for (int j = (i == a ? b : 0); j < v[i].size(); ++j) {
      if (v[i][j] < t) {
        ri = i;
        rj = j;
        t = v[i][j];
      }
    }
  }
  return make_pair(ri, rj);
}
struct A {
  int a, b, c, d;
  A(int a = 0, int b = 0, int c = 0, int d = 0) : a(a), b(b), c(c), d(d) {}
};
int main() {
  int n;
  cin >> n;
  v.resize(n);
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    v[i].resize(c[i]);
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < v[i].size(); ++j) cin >> v[i][j];
  vector<A> rz;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < v[i].size(); ++j) {
      pair<int, int> t = f(i, j);
      if (t.first != i || t.second != j) {
        swap(v[i][j], v[t.first][t.second]);
        rz.push_back(A(i, j, t.first, t.second));
      }
    }
  }
  cout << rz.size() << endl;
  for (int i = 0; i < rz.size(); ++i) {
    printf("%d %d %d %d\n", rz[i].a + 1, rz[i].b + 1, rz[i].c + 1, rz[i].d + 1);
  }
  return 0;
}
