#include <bits/stdc++.h>
using namespace std;
struct output {
  int x1, x2, y1, y2, o1, o2;
} ot[3000];
struct Node {
  int x, ord1, ord2;
} node[3000], nt[3000];
struct pos {
  int x, y;
} p[3000];
int c[55], a[3000], ord[3000];
bool comp(Node n1, Node n2) { return n1.x < n2.x; }
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int i, j;
    for (i = 1; i <= n; i++) scanf("%d", &c[i]);
    int cnt = 0;
    for (i = 1; i <= n; i++)
      for (j = 1; j <= c[i]; j++) {
        p[cnt].x = i;
        p[cnt].y = j;
        a[cnt] = cnt;
        scanf("%d", &node[cnt].x);
        node[cnt++].ord1 = cnt;
      }
    memcpy(nt, node, sizeof(node));
    sort(node, node + cnt, comp);
    for (i = 0; i < cnt; i++) node[i].ord2 = i;
    int ans = 0;
    for (i = 0; i < cnt; i++) ord[node[i].ord1] = node[i].ord2;
    for (i = 0; i < cnt; i++) {
      int temp;
      if (node[i].ord1 != node[i].ord2) {
        ot[ans].o1 = node[i].ord1;
        ot[ans++].o2 = node[i].ord2;
        int pos1, pos2;
        pos1 = node[i].ord1;
        node[i].ord1 = node[i].ord2;
        node[ord[node[i].ord2]].ord1 = pos1;
        pos2 = ord[node[i].ord2];
        ord[node[i].ord2] = node[i].ord2;
        ord[pos1] = pos2;
      }
    }
    cout << ans << endl;
    for (i = 0; i < ans; i++) {
      int t1 = ot[i].o1, t2 = ot[i].o2;
      cout << p[t1].x << " " << p[t1].y << " " << p[t2].x << " " << p[t2].y
           << endl;
    }
  }
  return 0;
}
