#include <bits/stdc++.h>
using namespace std;
int c[51];
int a[52][52];
struct ans {
  int a, b, c, d;
  ans(int aa, int bb, int cc, int dd) : a(aa), b(bb), c(cc), d(dd) {}
  void print() { printf("%d %d %d %d\n", a, b, c, d); }
};
vector<ans> v;
int main() {
  int n;
  scanf("%d", &n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
    s += c[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) scanf("%d", &a[i][j]);
  }
  int x = n - 1;
  int y = c[x] - 1;
  for (int f = s; f >= 1; f--) {
    int fx, fy;
    bool ok = 0;
    for (int i = 0; !ok && i < n; i++) {
      for (int j = 0; !ok && j < c[i]; j++) {
        if (a[i][j] == f) {
          fx = i;
          fy = j;
          ok = 1;
        }
      }
    }
    if (ok && (x != fx || y != fy)) {
      v.push_back(ans(x + 1, y + 1, fx + 1, fy + 1));
      swap(a[x][y], a[fx][fy]);
    }
    y--;
    if (y < 0) {
      x--;
      y = c[x] - 1;
    }
  }
  printf("%d\n", v.size());
  for (int i = 0; i < v.size(); i++) v[i].print();
}
