#include <bits/stdc++.h>
using namespace std;
int n, a[55][55], c[55], sp[55];
int d[55][55];
struct Struct {
  int a, b, c, d;
};
vector<Struct> sol;
void ie(int x, int y, int val) {
  int i, j, x1, y1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++)
      if (a[i][j] == val) {
        x1 = i;
        y1 = j;
      }
  Struct temp;
  temp.a = x;
  temp.b = y;
  temp.c = x1;
  temp.d = y1;
  sol.push_back(temp);
  a[x1][y1] = a[x][y];
  a[x][y] = val;
}
int main() {
  int i, j, nr = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) scanf("%d", &a[i][j]);
  for (i = 1; i <= n; i++) sp[i] = sp[i - 1] + c[i];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) d[i][j] = sp[i - 1] + j;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++)
      if (a[i][j] != d[i][j]) {
        nr++;
        ie(i, j, d[i][j]);
      }
  printf("%d\n", nr);
  for (i = 0; i < sol.size(); i++)
    printf("%d %d %d %d\n", sol[i].a, sol[i].b, sol[i].c, sol[i].d);
  return 0;
}
