#include <bits/stdc++.h>
using namespace std;
struct data {
  int r1, r2;
  int c1, c2;
  data(int a, int b, int c, int d) : r1(a), c1(b), r2(c), c2(d) {}
};
int main() {
  int n;
  scanf("%d", &n);
  int c[55];
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  vector<data> V;
  int table[55][55];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++) scanf("%d", &table[i][j]);
  for (int i = n; i > 0; i--)
    for (int j = c[i]; j > 0; j--) {
      int maxx = table[i][j];
      int rr, cc;
      for (int jj = j - 1; jj > 0; jj--)
        if (table[i][jj] > maxx) {
          maxx = table[i][jj];
          rr = i, cc = jj;
        }
      for (int ii = i - 1; ii > 0; ii--)
        for (int jj = c[ii]; jj > 0; jj--)
          if (table[ii][jj] > maxx) {
            maxx = table[ii][jj];
            rr = ii, cc = jj;
          }
      if (maxx > table[i][j]) {
        swap(table[i][j], table[rr][cc]);
        V.push_back(data(i, j, rr, cc));
      }
    }
  printf("%d\n", V.size());
  for (int i = 0; i < V.size(); i++)
    printf("%d %d %d %d\n", V[i].r1, V[i].c1, V[i].r2, V[i].c2);
  return 0;
}
